Skip to content
100% local

Regex explainer

Break a regular expression into plain-English steps, one piece at a time.

Input
Output

Regex explainer

Paste a regular expression and this tool breaks it down piece by piece, turning cryptic syntax like ^[\w.+-]+@[\w-]+\.[a-zA-Z]{2,}$ into a plain-English walkthrough of what each part actually matches. It accepts a bare pattern or a full /pattern/flags literal, so you can drop in exactly what you copied from a code editor, a validation library, or an old Stack Overflow answer.

Turn on Explain flags for a line-by-line meaning of g, i, m, s, u and the rest; List capturing and named groups to see every (…) at a glance, handy once a pattern has more of them than you can count; Warn about backtracking risk to flag nested, unbounded repetition — the classic (a+)+ shape that can freeze a regex engine on the wrong input; Suggest simpler notation for easy rewrites like [0-9] to \d; and Generate sample match to produce a short string the pattern actually accepts, useful as a quick sanity check. Choose Tree or Numbered steps for how the breakdown is laid out, and JavaScript, PCRE or Python as the dialect for notes on named-group syntax and possessive quantifiers.

The parser is written from scratch rather than borrowed from a single engine, so its explanations stay consistent across dialects and it copes correctly with escaped characters, Unicode code points and emoji inside literal text — nothing gets split into the wrong pieces.

Everything runs locally in your browser. A pattern built around an API key format or a personal-data validator never leaves your machine. Copy the explanation, download it as a .txt file, or send the output back into the input to explore a related pattern next.

FAQ

Which regex dialect should I pick?
JavaScript covers what actually runs in a browser; switch to PCRE or Python only when you want their dialect-specific notes on named groups and possessive quantifiers — the breakdown itself reads the same pattern the same way in all three.
Can it catch every catastrophic-backtracking pattern?
No. It flags the most common cause — nested unbounded repetition like (a+)+ — as a heuristic. Treat a warning as worth a second look, not a guarantee, and treat a clean result the same way.
How accurate is the generated sample string?
It's a deterministic, best-effort example built by walking the pattern once. It's reliable for straightforward patterns, but lookarounds and complex backreferences are only approximated.
Does it validate the pattern against a real regex engine?
No — it runs its own parser so the same explanation works for JavaScript, PCRE and Python syntax without a browser-only engine getting in the way. Genuinely obscure syntax may be reported as invalid even where a specific engine would accept it.
Is my regular expression uploaded anywhere?
No. Explaining a pattern runs entirely in your browser — the text you paste is never sent to a server.