Regex Tester
Test JavaScript regular expressions against sample text with live matches, capture groups, named groups and clear syntax errors.
Enter the pattern only — no leading or trailing slash.
eval: a regex describes text to look for and cannot execute code.How it works
- Type a regular expression, without the surrounding slashes.
- Choose the flags you want, then paste the text to test against.
- Matches, capture groups and highlighting update as you type, entirely in your browser.
Frequently Asked Questions
Which regex flavour is this?
JavaScript, using the browser’s own RegExp engine — so what you see here is exactly what your JavaScript or TypeScript code will do. Patterns that rely on PCRE or Python features, such as recursion or possessive quantifiers, are not supported because the engine does not support them.
Does it execute my code?
No. The pattern is compiled with the RegExp constructor, which accepts only a pattern — it cannot run arbitrary JavaScript. There is no eval and no Function constructor anywhere in this tool.
Why was my pattern refused?
Some patterns backtrack catastrophically: (a+)+$ against a long run of a’s followed by a b takes exponential time, and JavaScript cannot interrupt a running match. Rather than freeze your tab, the tool detects those shapes — a quantifier applied to a group that itself ends in a quantifier, and overlapping alternations — and declines to run them. The check is deliberately conservative, so it occasionally refuses a pattern that would have been fine.
Are capture groups shown?
Yes: numbered groups, named groups, and the exact character offsets of every match. A group that did not participate in a match is shown as null rather than being omitted, since that distinction matters when you read the result in code.