Regex Tester
Test JavaScript regular expressions with live match highlighting and numbered capture groups.
How It Works
The Regex Tester evaluates JavaScript regular expressions live as you type, using the browser’s native RegExp engine — the same engine that runs in your code, so what you see here is exactly what you will get in production. Type your pattern in the regex field, set flags (g for global, i for case-insensitive, m for multiline, s for dotAll, u for Unicode, y for sticky), and paste a sample string into the test area. Every match is highlighted in the test text and listed below with its position and any captured groups. Errors in your pattern (unbalanced parentheses, invalid escape sequences, lookbehind syntax errors) are surfaced inline with the JavaScript engine’s exact error message. Standard regex constructs are supported: character classes, anchors (^, $, \b), quantifiers (greedy, lazy, possessive via lookarounds), backreferences (\1, \k
Use Cases
- Prototyping input-validation patterns before adding them to code
- Extracting structured data — dates, emails, IDs — from raw text
- Learning regex syntax interactively with instant visual feedback
- Testing edge cases for log-parsing rules
Frequently Asked Questions
- Which regex flavour does this tool support?
- The ECMAScript regex flavour as implemented by your browser's JavaScript engine — exactly what you get inside string.match or new RegExp at runtime.
- Why does my Perl/Python regex not work?
- Some constructs differ: ECMAScript lacks possessive quantifiers and some Unicode property syntax, and lookbehind support varies by browser version. Test with the u flag enabled for Unicode-aware behaviour.
- What does the global flag do here?
- With g enabled, every match in the test string is highlighted and listed. Without it, only the first match is shown.
- How do I match a literal dot or asterisk?
- Escape it with a backslash: \. for a dot, \* for an asterisk. Backslashes do not need to be doubled in the pattern field — paste them as-is.
- Is my pattern sent to a server?
- No. Pattern compilation and matching happen entirely in your browser via native RegExp.