Test a regular expression live with match highlighting and capture groups.
Runs locally in your browser.
How do you test a regular expression?
Paste a pattern and your text to see matches highlighted live. The pattern is compiled with the JavaScript RegExp engine: with the g flag every match is found, without it only the first, and capture groups are shown per match. For example, \d+ with the g flag finds 12 and 345 in "a12b345". Everything runs in your browser.
Understanding your result
This uses the same regex engine as your browser and Node.js, so patterns behave exactly as they will in JavaScript.
Formula and method
The pattern is compiled with the JavaScript RegExp engine. With the g flag every match is found; without it, only the first. Capture groups are shown for each match.
Assumptions and limitations
This runs the JavaScript RegExp engine, so patterns behave exactly as in browsers and Node.js but not identically to PCRE, Python or .NET flavours. Features those engines offer, such as lookbehind in older runtimes, recursion or possessive quantifiers, may be unsupported, and very greedy patterns on large text can be slow.
Worked example
The pattern \d+ with the g flag finds 12 and 345 in “a12b345”.
How to use this tool
- Enter your pattern (without slashes).
- Add any flags, such as g for global or i for case-insensitive.
- Paste a test string and read the highlighted matches.
Common mistakes to avoid
- Wrapping the pattern in slashes — enter the pattern only, and put flags in the flags box.
- Forgetting the g flag when you want all matches, not just the first.
About the Regex Tester
Test a regular expression against any text and see the matches highlighted instantly, with capture groups and a match count. Everything runs in your browser.
Who should use this tool
Developers writing and debugging regular expressions for validation, search or parsing.
Benefits
- See matches highlighted the instant you edit the pattern
- Inspect every capture group for each match
- Test against the exact engine your JavaScript will use
- Try patterns privately with nothing leaving your browser
Practical use cases
- Build and refine a pattern before pasting it into code
- Debug why a regex is matching too much or too little
- Extract data from log lines or free text
- Learn regular expressions through immediate visual feedback
Explore all Developer Tools tools
Frequently asked questions
Which flavour of regex is this?
JavaScript (ECMAScript) regular expressions, matching how they run in browsers and Node.js.
Are capture groups supported?
Yes. Each match lists its captured groups in order.
Will a pattern that works here behave the same in Python?
Not always. This tool uses the JavaScript engine, and other flavours like Python, PCRE or .NET differ in syntax and available features. Simple patterns usually transfer, but named groups, lookbehind, Unicode handling and escape rules can vary. Always retest a borrowed pattern in the language you will actually run it in.