Regex Tester
Test regular expressions live with flags, match highlighting and capture groups.
Loading tool…
How to use it
- Write your regular expression in the Pattern field — JavaScript syntax, like \b\w+@\w+\.\w+\b.
- Type sample text below it: matches are highlighted live and listed with their positions and capture groups.
- Toggle flags with the checkboxes: g finds every match, i ignores case, m makes ^ and $ match line boundaries.
- Optionally fill the Replacement field (with $1, $2 references) to preview a string replacement, then copy the result.
About this tool
Enter a pattern and a sample text to see every match highlighted in real time, including capture groups. Flags such as global, case-insensitive and multiline can be toggled individually, and a substitution mode lets you preview replacements before applying them. Long-running patterns are guarded against catastrophic backtracking.
Your input never leaves the browser: this tool works entirely offline once the page has loaded.
Frequently asked questions
Which regex flavor does the tester use?
JavaScript's native RegExp engine, exactly as it behaves in your browser. Patterns that work here work in JS code with the same flags.
Can a regular expression freeze the page?
Pathological patterns can be slow, but the tester caps execution at 10,000 matches and reports truncated results instead of looping forever. For complex patterns, test them against smaller samples first.
What does the $1 in the replacement field mean?
$1, $2… reference the capture groups of your pattern, in order. $0-style backreferences are not supported because JavaScript replace() does not provide them.