Regex Explainer
Dissect any regex into a token-by-token plain-English breakdown
| Token | Meaning |
|---|---|
| ^ | Start of string (or line with /m) |
| (?<scheme> | Named capture group "scheme" — begin |
| h | Literal 'h' |
| t | Literal 't' |
| t | Literal 't' |
| p | Literal 'p' |
| s | Literal 's' |
| ? | Quantifier — 0 or 1 (greedy) |
| ) | Group — end |
| : | Literal ':' |
| \/ | Literal '/' |
| \/ | Literal '/' |
| (?<host> | Named capture group "host" — begin |
| [^/:] | Any character NOT in the set: /: |
| + | Quantifier — 1 or more (greedy) |
| ) | Group — end |
| (?: | Non-capturing group — begin |
| : | Literal ':' |
| (?<port> | Named capture group "port" — begin |
| \d | Any digit (0-9) |
| + | Quantifier — 1 or more (greedy) |
| ) | Group — end |
| ) | Group — end |
| ? | Quantifier — 0 or 1 (greedy) |
| (?<path> | Named capture group "path" — begin |
| \/ | Literal '/' |
| [^?#] | Any character NOT in the set: ?# |
| * | Quantifier — 0 or more (greedy) |
| ) | Group — end |
| ? | Quantifier — 0 or 1 (greedy) |
| (?: | Non-capturing group — begin |
| \? | Literal '?' |
| (?<query> | Named capture group "query" — begin |
| [^#] | Any character NOT in the set: # |
| * | Quantifier — 0 or more (greedy) |
| ) | Group — end |
| ) | Group — end |
| ? | Quantifier — 0 or 1 (greedy) |
| (?: | Non-capturing group — begin |
| # | Literal '#' |
| (?<frag> | Named capture group "frag" — begin |
| . | Any character except newline (unless /s flag) |
| * | Quantifier — 0 or more (greedy) |
| ) | Group — end |
| ) | Group — end |
| ? | Quantifier — 0 or 1 (greedy) |
| $ | End of string (or line with /m) |
How to use
- Paste a regex pattern
- Review the token breakdown
- Check the compile indicator
Use cases
- Regex debugging
- Code review
- Learning regex
About the Regex Explainer
Regex is the most-reached-for tool in programming and the hardest to read. This explainer walks through your pattern token by token, naming each anchor, quantifier, group, and character class in English. Pair with the Regex Tester for full understanding: explain → verify → ship.
Features
- Token-level breakdown with plain-English explanations
- Recognizes all standard regex syntax: classes, quantifiers, groups, anchors, escapes, lookaround
- Named capture group detection
- Backreference detection
- Compile check against JavaScript regex engine
How it works
- Paste a regex pattern.
- Review the token breakdown table.
- Check the 'compiles as valid' indicator — catches escape-balance mistakes.
Frequently asked questions
How is this different from the Regex Tester tool?
+
Regex Tester runs your regex against test strings and shows matches. Regex Explainer dissects the regex itself into human-readable tokens — complementary: use Explainer to understand, Tester to verify.
Which regex flavor?
+
JavaScript / ECMAScript (RegExp). Features like possessive quantifiers (a++) aren't supported; lookbehind works on modern browsers.
Does it explain PCRE / Python re?
+
Mostly — the core syntax is shared. Extensions specific to PCRE (e.g. atomic groups (?>)) are flagged as 'unknown' in the breakdown.
Why are brackets still opaque in my breakdown?
+
Character classes [abc] are summarized as a single token. For finer-grained analysis, split classes and run each character through the tool individually.
Can I test patterns here too?
+
Use our Regex Tester for live matching + highlighting; Regex Explainer focuses on explanation.