Regex Tester and Explainer
Test JavaScript regular expressions, see highlighted matches, inspect capture groups, and read an English explanation.
No matches yet. Adjust the pattern or the test text.
What the Regex Tester does
- Matches your pattern against test text as you type, highlighting every match in place.
- Lists each match with its position, numbered capture groups and named groups.
- Explains the pattern in plain English, piece by piece, including what each flag changes.
- Puts the pattern, flags and test text in the page URL, so a link reproduces exactly what you're looking at.
What it doesn't do
- It only supports JavaScript regular expressions. PCRE, Python and .NET features such as atomic groups, recursion and possessive quantifiers aren't available here.
- It doesn't rewrite or optimise your pattern.
- It stops after 10,000 matches to keep the page responsive.
Frequently asked questions
Why does my pattern work here but not in Python?
This runs the JavaScript engine, and the dialects differ. Lookbehind syntax, named group syntax and some escape sequences aren't identical, and Python supports constructs JavaScript has never had. Test against the language you'll actually deploy in.
What does the g flag change?
Global finds every match rather than stopping at the first. Without it, only the first match is reported — which is the usual explanation when a pattern seems to match "only once" despite looking correct.
Why does my pattern hang or match nothing?
A pattern that can match an empty string repeatedly, like a bare quantifier over an optional group, can loop indefinitely. This tool advances past empty matches and caps the total, so it stays responsive — but the same pattern may hang in your own code.