Skip to content

Regex Tester

Test JavaScript regular expressions locally with g/i/m/s/u/y flags, match counts, line-column ranges, capture groups, named groups, and native replace preview.

/

/g

0 matches0 capture groups0 named groups

Test Text

Characters

0 / 50,000

Match Results

Enter a pattern to start matching

Replacement

Characters

0 / 50,000

Replacement Preview

Regex Tester

Quick Start

1
Enter a regex pattern, select flags (g/i/m/s/u/y), and paste test text; matches update in real time
2
Capture groups (...) and named groups (?<name>...) are expanded under each match showing captured values
3
Enter a replacement template ($1, $2, $<name>) and the "Replacement Preview" on the right shows the result instantly

Common Scenarios

Data extraction

use (\\d{4}-\\d{2}-\\d{2}) to extract dates, and ([\\w.]+@[\\w.]+) to extract email addresses

Format validation

write a regex, paste multiple samples, and quickly verify whether the pattern precisely matches the target format

Batch replacement

use capture groups to restructure content. For example, convert "First Last" to "Last, First" with pattern (\\S+)\\s+(\\S+) and replacement $2, $1

Named groups

use (?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2}) to extract dates, then use $<year>/$<month>/$<day> to rebuild them

Regex learning

try different patterns and observe matching behavior to understand quantifiers, anchors, and character classes visually

Multi-line handling

enable the m flag so ^ and $ match by line, useful for logs, code, and configuration files

Usage Advice

Global search (g) is enabled by default; turn it off only when you need the first match
In this tool, enter \\d, \\w, and \\s directly; no double escaping is needed like in code strings
m makes ^ and $ match by line, while s lets . match newline characters; they solve different problems and can be combined when needed
Prefer specific patterns over broad .* patterns to avoid unexpected matches.
Always verify replacement output before applying it elsewhere.
The tool includes performance-risk detection and warns about patterns that may cause catastrophic backtracking, such as nested quantifiers

Limitations & Compatibility

This tool uses your browser's JavaScript RegExp engine. It does not switch to PCRE, Python, Java, Go, recursive patterns, conditional branches, or atomic groups.
Lookbehind assertions (?<=...) require Chrome 62+ / Firefox 78+ / Safari 16.4+; JavaScript usually requires fixed length, so avoid variable quantifiers like * or + inside the assertion
Large text with complex patterns can trigger catastrophic backtracking. CrateX.app uses a worker, risk warning, safety mode, and timeout protection, but it is not a ReDoS proof.

Privacy & Security

Pattern, test text, and replacement text are processed locally as session drafts. Flags and editor display settings stay as device preferences; there is no upload, cloud sync, share link, or remote history.

FAQ

6

Continue with these related tools for the next step.

All tool processing happens locally in your browser.