Regex Tester
Test a regular expression against sample text, with live match highlighting
About this tool
A regular expression is easy to write and hard to trust. This tester runs yours against your own sample text as you type, highlights every match in place, and lists each match with its index and its capture groups — numbered and named — so you can see exactly what the pattern took and what it skipped.
The engine is the browser's own, so what you see here is what String.prototype.match, replace and split will do in Node or in the browser. Flags are toggled individually, and a replacement field previews the result of a replace with $1 and
lt;name> substitutions.When to use it
- Proving a validation pattern accepts the inputs you expect and rejects the rest
- Pulling a field out of a log line, header or URL before you write the code
- Debugging why a greedy quantifier is swallowing more than you intended
- Checking a replacement with capture group references before running it over real data
Worked example
Input
/(\w+)@(\w+)\.com/g on "[email protected], [email protected]"
Output
Match 1 [email protected] at 0 groups: ana, example
Match 2 [email protected] at 17 groups: bo, test
The g flag keeps the scan going after the first hit; without it only Match 1 is returned.
Frequently asked questions
Which regex flavour does this use?
JavaScript's, via the browser's own RegExp engine. Most of it is shared with PCRE, but lookbehind support, named groups and the u/y flags are JavaScript-specific, and there is no /x extended mode.
Why does my pattern hang the page?
Nested quantifiers over a long string can backtrack catastrophically — (a+)+$ is the classic example. The tester caps the work it will do and reports it instead of freezing, but the same pattern would stall a real server too.
Is my test data sent anywhere?
No. The pattern and the sample text stay in your browser; nothing is uploaded or logged.