# Regex Explainer

Break a regular expression down into plain English, piece by piece, and flag the patterns that are dangerous rather than merely wrong: nested quantifiers that backtrack catastrophically, missing anchors that let a match float anywhere in the input, unescaped dots that match more than intended, and character classes whose ranges do not cover what their author assumed.

**Not for:** Does not execute or test the expression against sample input, and does not translate between regex dialects. Recognises JavaScript regex syntax; Perl, PCRE, and .NET constructs that JavaScript lacks are reported as unsupported rather than guessed at.

## Surfaces

- HTML: `https://regex-explainer.gumballtools.com`
- Markdown: same URLs with `Accept: text/markdown` or `?format=md`
- JSON API: `https://regex-explainer.gumballtools.com/api/v1/explain`
- OpenAPI: `https://regex-explainer.gumballtools.com/.well-known/openapi.json`
- MCP: `https://regex-explainer.gumballtools.com/api/mcp`

## Worked examples

- [The email validation regex that hangs](https://regex-explainer.gumballtools.com/regex/email-validation-regex) — A widely copy-pasted email pattern with nested quantifiers. It works on valid input and takes minutes on the wrong invalid input.
- [Catastrophic backtracking, minimal example](https://regex-explainer.gumballtools.com/regex/catastrophic-backtracking-example) — The smallest pattern that exhibits exponential backtracking. Three characters longer than the safe version and indistinguishable by eye.
- [What does \d mean in regex?](https://regex-explainer.gumballtools.com/regex/what-does-slash-d-mean) — The digit class, and what it does and does not include.
- [Regex for a YYYY-MM-DD date](https://regex-explainer.gumballtools.com/regex/regex-for-date-yyyy-mm-dd) — Named capture groups for the parts, and why this validates shape but not calendar validity.
- [Regex for a semantic version](https://regex-explainer.gumballtools.com/regex/regex-for-semantic-version) — Escaped dots, and what happens when you forget to escape them.
- [Why an unescaped dot matches too much](https://regex-explainer.gumballtools.com/regex/unescaped-dot-in-regex) — A pattern written for a domain name that also matches strings with no dot in them at all.
- [Why [A-z] is almost never what you want](https://regex-explainer.gumballtools.com/regex/a-to-z-character-range) — Ranges follow character codes, not the alphabet, so this one quietly includes six punctuation characters.
- [Greedy vs lazy quantifiers](https://regex-explainer.gumballtools.com/regex/greedy-vs-lazy-quantifiers) — The same pattern with and without the lazy modifier, and what each one actually consumes.
- [Lookahead for password rules](https://regex-explainer.gumballtools.com/regex/lookahead-password-validation) — Stacked lookaheads let you require several things at once without dictating their order.
- [What ^ and $ actually anchor to](https://regex-explainer.gumballtools.com/regex/regex-anchors-explained) — The difference between validating a whole value and finding one inside other text.
- [Why ^a|b does not mean what it looks like](https://regex-explainer.gumballtools.com/regex/alternation-precedence-trap) — Alternation binds more loosely than everything else, so the anchor applies to only one branch.
- [Regex for a URL](https://regex-explainer.gumballtools.com/regex/regex-for-url) — A practical URL pattern, with the parts that are easy to get subtly wrong called out.
- [What \b matches](https://regex-explainer.gumballtools.com/regex/word-boundary-regex) — Word boundaries are positions, not characters, which is why they behave oddly at the edges of a string.
- [Regex for a hex colour](https://regex-explainer.gumballtools.com/regex/regex-for-hex-color) — Three or six hex digits, and why the alternation order matters here.

