Regex Tester
Test a JavaScript regular expression against your text, with live match highlighting and capture groups.
Uses your browser's JavaScript regex engine. Without the g flag only the first match is returned, mirroring String.match.
About the Regex Tester
Build and debug a regular expression against live sample text and see every match highlighted as you type. Regex is powerful but unforgiving, and the fastest way to get one right is to watch what it actually matches — this tool shows you exactly that, including each capture group broken out by number or name.
All the JavaScript flags are one click away — global, case-insensitive, multiline, dotall, unicode and sticky — so you can see how each one changes the result. It guards against the classic zero-width-match infinite loop and caps runaway patterns, so an experimental expression can never hang the page.
How to use it
- Type your regular expression in the pattern field.
- Toggle the flags you need — g, i, m, s, u or y.
- Paste the text you want to test against.
- Watch matches highlight live, and expand a match to see its capture groups.
Good to know
- Live match highlighting as you edit the pattern or the text.
- All JavaScript flags: global, ignore-case, multiline, dotall, unicode and sticky.
- Per-match capture group breakdown, with named groups labelled by name.
- Safe against zero-width and runaway matches; everything runs in your browser.
Frequently asked questions
Which regex flavour does this use?
It uses the JavaScript (ECMAScript) regular expression engine, the same one that runs in browsers and Node.js. Most features are shared with other flavours, but some syntax such as lookbehind or named groups can differ between languages.
What do the flags do?
g finds all matches instead of just the first, i ignores case, m makes ^ and $ match line boundaries, s lets a dot match newlines, u enables full unicode handling, and y anchors each match to where the last one ended.
How do I see my capture groups?
Each match lists its capture groups in order, and any named groups are shown by their name. This makes it easy to confirm that the parentheses in your pattern are capturing the pieces you expect.
Can a bad pattern freeze the page?
No. The tester caps the number of matches and guards against zero-width matches that would otherwise loop forever, so you can experiment freely without locking up your browser.