Regex Explainer — Break Any Regular Expression Into Plain English

//
Flags:
Pattern Breakdown7 tokens
TokenTypeExplanation
(group startCapture group #1
\w+character classOne or more word characters
)group endEnd of capture group #1
@literalA literal '@'
(group startCapture group #2
[\w.-]+character setAny one character of: word characters, '.', '-' (one or more times (greedy))
)group endEnd of capture group #2

Active Flags

/gGlobal: Find all matches rather than stopping after the first match.
Your regex and test data stay in your browser.
3 lines · 54 bytes
Support project

Regex Explainer — Break Any Regular Expression Into Plain English

Drop in a pattern you inherited, found in a config file, or wrote six months ago, and read back what each token actually does — anchors, character classes, capture groups, quantifiers, lookarounds and flags, in the order the engine consumes them.

  • Toggle flags to see how `g`, `i`, `m` and `s` change what the pattern means.
  • Nested groups are indented, so alternations inside a group stay attributable.
  • Unknown or unsupported escapes are reported instead of being glossed over.

This tool runs entirely in your browser. Your patterns and text are not uploaded, stored, or logged.

Why regex explanation is a debugging tool, not a tutorial

Most regex bugs are not syntax errors. The pattern compiles fine and silently matches something adjacent to what you intended — a greedy `.*` that swallows the rest of the line, a `.` that crosses a newline, a character class where you meant a group. Reading the tokens in order forces you to confront each of those decisions.

Use it in the loop, not just once: explain the pattern, change one token, explain again. The diff between two explanations is usually enough to find the bug without ever reaching for a debugger.

How to read the output

Each line corresponds to one AST node of the pattern: an assertion, a quantified atom, a group, or an alternation branch. Quantifiers are printed with their bound (minimum, maximum) and their greediness, because `a{2,}`, `a{2,}?` and `(?:a){2,}` behave differently on real input even though they look similar.

If the explanation names a construct you do not recognise, that is the token to test in isolation. Move it to the tester tab, feed it one short string, and confirm the behaviour before putting it back in the full pattern.

  • Assertions (`^`, `$`, `\b`, lookaheads) match a position, never a character.
  • Character classes match exactly one character; groups match nothing on their own.
  • A quantifier binds to the atom immediately to its left, not to the whole expression.

Privacy and engine fidelity

Patterns frequently contain internal hostnames, customer identifiers or fragments of proprietary formats. The explanation is computed locally in JavaScript against the same ECMAScript `RegExp` engine your application uses, so nothing is transmitted and the semantics match your runtime rather than a different flavor such as PCRE.

Frequently asked questions

Does the explainer support lookbehind and named groups?

Yes. Named capture groups, non-capturing groups, lookahead, lookbehind, backreferences, unicode property escapes and the `v`/`u` mode differences are all recognized, because the pattern is parsed against the native JavaScript engine.

Why does my pattern fail to explain?

The pattern has to compile first. An unbalanced bracket, a dangling quantifier or an unknown escape is a syntax error, and the tool reports the compiler message with its position instead of guessing at a meaning.

Is my pattern sent to a server?

No. Parsing and explanation happen entirely in your browser; no pattern, flag or sample text leaves the device and nothing is logged.

Related

Support the free tools