Regular Expression Explainer
WebEverything runs locally in your browser — nothing is uploaded
Break a regex into its parts and say what each one actually matches. The hard part of reading someone else’s pattern is rarely the syntax — it is that nobody tells you what each piece is for, and that unreadable line usually turns out to be three character classes and two assertions. This is read by a parser, not “explained by a model”. A regex has one definite meaning, and when a model gets it wrong you have no way to check — it will say “`*` means one or more” in exactly the same confident tone, and you will make your code worse with that explanation. A parser that gets it wrong fails a test (this module has 44 assertions); a model that gets it wrong does not. Three things are deliberately spelled out: · Quantifiers stay attached to what they modify. In `ab*` the `*` applies to `b`, not `ab`, so the output shows two lines — `a` and `b*` — rather than three separate tokens, which would hide exactly that fact. · Metacharacters inside a character class are not expanded. The `.` and `*` in `[.*]` are those two characters, not “any character” and “a quantifier”. It is the single most common misreading of regex, so it is stated rather than expanded. · A quantifier with nothing before it is called out. `*abc` is a syntax error in most engines; treating it as a literal `*` would leave you believing it matches one. ⚠️ It does not judge whether a pattern is right or fast — run it for real with the regex tester here. This tool only answers “what does this say”.
Features
- Lists each piece with what it matches, indented by bracket depth
- Quantifiers stay with the element they modify (`a*` is one line, not two)
- Character classes in plain words: `[a-z0-9_]` lists each range and character; negated classes too
- ⚠️ Metacharacters inside a class are not expanded — the ones in `[.*]` are just characters
- Groups by kind: capturing, named, non-capturing, lookahead and lookbehind
- Covers shorthand classes (`\d` `\w` `\s` `\b`), control characters, backreferences (numeric and named) and Unicode properties (`\p{…}`)
- Explains each flag (`g` `i` `m` `s` `u` `y` `d` `v`)
- ⚠️ Unclosed brackets, unclosed classes and orphan quantifiers are reported, rather than explained past
- Accepts the usual `/pattern/flags` form, or just the pattern
- No network, no model — every sentence comes from the structure of the pattern itself
How to use
- Paste a regex — with or without `/` delimiters
- Read the breakdown below; indentation shows nesting
- Flags, if any, get their own section at the end
- To actually try a match, use the regex tester
FAQ
- Why not have an AI explain regexes?
- Because you cannot check its explanation. A regex has one definite meaning, and a model that gets it wrong sounds exactly as confident — “`*` means at least one” is the kind of thing that a reader who does not already know cannot spot, and acting on it makes the code worse. A parser is different: it reads one character and emits one sentence, a mistake turns a test red immediately (44 assertions guard this module), and the same pattern gets the same explanation anywhere. There is no reason to hand a model a job an explainer already does.
- In `ab*`, does the star apply to b or to ab?
- To `b`. A quantifier applies to the single element immediately before it — `ab*` matches an `a` followed by zero or more `b`s. To repeat the pair you must write `(ab)*`. It is the most common beginner mistake, so the output puts the quantifier on the same line as what it modifies (`a` on one line, `b*` on the next) rather than splitting it into the tokens `a`, `b`, `*`, which would hide who modifies what.
- What do the dot and star mean inside `[.*]`?
- They are just those two characters. Inside a character class, `.` is no longer “any character” and `*` is no longer a quantifier; they are ordinary members, and `[.*]` matches one dot or one star. It is one of the most common misreadings of regex, which is why this tool deliberately does not expand them and says outright that they are literals.
- How is this different from the regex tester?
- The division of labour is clean: this one answers “what does it mean”, that one answers “what does it actually match”. Use this when reading someone else’s pattern or checking your own logic; use that when you want to know whether a given text matches, what the capture groups caught (it also runs a replacement preview and flags ReDoS risk). Neither replaces the other: the clearest explanation is no substitute for one real match, and a result tells you nothing about why.
Related tools
Regex Tester
TextTest a regex in the browser: live highlighting, capture groups, replace preview, a backtracking guard — and JavaScript, Python, Java, Go or PHP code.
Regex Code Generator
WebTurn a regular expression into JavaScript, Python, Java, Go, PHP and C# snippets, focused on how many backslashes each language really needs.
Code Highlighter
WebColourise code and copy it with the colours intact into slides, Word or email — or export inline-styled HTML for a blog. 26 languages supported.
URL Parser
WebParse a URL into scheme, host, port, path, query parameters and fragment, with each parameter shown raw and decoded. Runs entirely in your browser.
User-Agent Parser
WebParse a user agent into browser, version, OS, device type and engine, and see which rules matched. Pattern matching only. Runs entirely in your browser.
HTTP Status Codes
WebLook up an HTTP status code for its meaning, 1xx–5xx class, typical uses and common traps. Runs entirely in your browser.