TextyConverterbeta
⌘K

Regex Explainer

Break down a regular expression into plain-English token explanations. Quick reference for unfamiliar patterns.

TokenMeaning
^Anchor: start of line/string
\dAny digit (0-9)
{3}Repeated exactly 3 times
-Literal '-'
\dAny digit (0-9)
{4}Repeated exactly 4 times
$Anchor: end of line/string

About Regex Explainer

Pastes a regex and produces a token-by-token explanation: what each metacharacter does, what character classes match, where groups begin and end, what quantifiers apply. Useful for quickly understanding an unfamiliar regex or as a teaching aid.

When to use it

  • Reading an unfamiliar regex from a codebase
  • Teaching regex syntax to newcomers
  • Sanity-checking that your pattern means what you think
  • Documenting a regex with its plain-English meaning

How it works

The pattern is tokenized left-to-right and each token is matched against a table of common regex constructs: anchors (^, $), character classes (\d, \w, \s, [abc]), quantifiers (*, +, ?, {n,m}), groups (capturing, non-capturing, lookaround), alternation (|), and escape sequences. The explanation is best-effort — it won't catch every nuance of complex patterns.

Examples

^\d{3}-\d{4}$
^ Anchor: start of line
\d Any digit (0-9)
{3} Repeated exactly 3 times
- Literal '-'
\d Any digit
{4} Repeated exactly 4 times
$ Anchor: end of line

Frequently asked questions

Is the explanation perfect?
It's heuristic. Common patterns are explained well; deeply nested or pathological patterns may not be fully described. For a guaranteed-correct explanation, walk through the pattern manually or use a visualizer like regexper.com.
Does it explain my flags?
No — the explanation focuses on the pattern itself. Flags (g, i, m, s, u, y) are listed in the regex-tester tool.

Related tools