Regex Explainer
Paste a regular expression and get a token-by-token explanation in plain English. See what each anchor, group, class, and quantifier does — and test live matches against your own input.
Flags
Explanation
17 tokens- 1
^Start anchor
Matches the start of the input. With the m flag, matches the start of each line.
- 2
(?<user>Named capture group: "user"
Opens a capturing group named "user". The match is accessible via groups.user.
- 3
[\w.+-]Character class
Matches any single character from: "word character", ".", "+", "-".
- 4
+Quantifier: 1 or more
Repeat the previous element one or more times (greedy — match as many as possible).
- 5
)Group end
Closes the most recently opened group.
- 6
@Literal character
Matches the literal character "@".
- 7
(?<domain>Named capture group: "domain"
Opens a capturing group named "domain". The match is accessible via groups.domain.
- 8
[\w-]Character class
Matches any single character from: "word character", "-".
- 9
+Quantifier: 1 or more
Repeat the previous element one or more times (greedy — match as many as possible).
- 10
(?:Non-capturing group start
Opens a group that does not save its match. Use to apply a quantifier to several tokens without creating a backreference.
- 11
\.Escaped character
Matches a literal ".". The backslash escapes its special meaning.
- 12
[\w-]Character class
Matches any single character from: "word character", "-".
- 13
+Quantifier: 1 or more
Repeat the previous element one or more times (greedy — match as many as possible).
- 14
)Group end
Closes the most recently opened group.
- 15
+Quantifier: 1 or more
Repeat the previous element one or more times (greedy — match as many as possible).
- 16
)Group end
Closes the most recently opened group.
- 17
$End anchor
Matches the end of the input. With the m flag, matches the end of each line.
Test Against Input
bob@example
not an email
About Regex Explainer
Regular expressions are powerful but notoriously dense — a single line can hide anchors, character classes, quantifiers, groups, and lookarounds all stacked together. Regex Explainer parses your pattern token by token and writes out, in plain English, exactly what each piece does and how the flags change behaviour.
The tool supports JavaScript / ECMAScript regex syntax: anchors (^, $, \b),
character classes ([a-z], [^0-9]), shorthand classes (\d \w \s), quantifiers
(*, +, ?, {n,m}), greedy vs lazy modes,
capturing and non-capturing groups, named groups ((?<name>...)), lookahead and lookbehind, alternation, escapes (\xFF, \u{1F600}),
and back-references (\1, \k<name>).
All parsing, validation, and matching happens locally in your browser — nothing is sent to a server.
How to Use Regex Explainer
- Type or paste your pattern into the Pattern box. Do not wrap it in slashes — those are shown for you.
- Enter any flags you need (
g,i,m,s,u,y,d) or click the flag toggle chips. - Read the Explanation panel — each token shows the raw text, a short label, and a sentence explaining what it does.
- If your regex is invalid, the error panel shows the exact JavaScript engine message.
- Paste sample text into the Test Against Input box to see matches highlighted live.
- Click Copy to copy the full plain-English explanation for code reviews, docs, or comments.
- Use Load Sample for a worked example, or Reset to start over.
Common Use Cases
Code review
Decode an unfamiliar regex from a pull request without trial-and-error in the console.
Documentation
Add a plain-English explanation next to every non-trivial regex in your codebase or docs.
Debugging mismatches
See exactly which token is too greedy or which class is missing a character.
Learning regex
Build intuition by writing a pattern and reading what each piece actually means.
Inherited code
Make sense of long, hand-tuned regexes in legacy validation, parsers, or rewrites.
Comparing engines
Confirm JavaScript-flavoured syntax before porting to PCRE, Python, or Go.
FAQ
Which regex flavour does this tool understand?
JavaScript / ECMAScript regex. That covers the syntax shipped in modern browsers and Node.js — including named groups,
lookbehind, and the u and d flags.
PCRE, Python, and Java accept slightly different extensions (e.g. possessive quantifiers, atomic groups) that JavaScript does not.
What's the difference between greedy and lazy quantifiers?
Greedy quantifiers (*, +, ?) match as much as they can.
Lazy versions (*?, +?, ??) match as little as possible.
The classic example: <.+> on <a><b> matches the whole thing — <.+?> matches only <a>.
When should I use a non-capturing group (?:...)?
Use it when you only need grouping — for quantifiers or alternation — but do not actually need to remember the match. Non-capturing groups keep capture indices clean, make patterns slightly faster, and avoid renumbering bugs when you add or remove groups.
What does ^ mean inside a character class?
Outside a class, ^ is the start anchor. Inside a class as the first character —
like [^abc] — it negates the class, matching any character not listed. Anywhere else inside the class it is a literal caret.
Why does my regex match nothing in the test panel?
Three common reasons: (1) anchors ^/$ only match the start/end of the whole string unless the m flag is set; (2) . does not match newlines unless the s flag is set;
(3) the pattern is case-sensitive — try adding the i flag.
Is my pattern sent to a server?
No. Parsing, validation, and matching all run in your browser using the native JavaScript regex engine. There is no network call.