Regex Explainer
Free regex explainer. Break a regular expression down token by token into plain English.
Why a token-by-token walk instead of a full grammar
Regular expression syntax is dense by design — a huge amount of meaning packed into very few characters, which is exactly what makes an unfamiliar pattern hard to read at a glance. This tool walks the pattern left to right, identifying each syntactic unit (an anchor, a character class, a quantifier, a group boundary) and explaining it individually, which mirrors how a person actually has to read an unfamiliar regex: piece by piece, building up the full meaning incrementally rather than parsing the whole expression's structure at once. It's deliberately not a full formal-grammar parser, since a linear walk covers the vast majority of real-world patterns while staying simple enough to never crash on something unexpected — worst case, an exotic construct gets described less precisely rather than blocking the rest of the explanation.
Greedy vs. lazy quantifiers — the distinction that trips people up most
A quantifier like `*` or `+` is greedy by default: it tries to match as much as possible, backtracking only if the rest of the pattern fails to match otherwise. Appending `?` to a quantifier (`*?`, `+?`) makes it lazy: it tries to match as little as possible instead. The practical consequence shows up constantly with patterns like `<.+>` against HTML — greedy matching grabs from the first `<` to the very last `>` in the string, which is almost never what someone intended, while `<.+?>` stops at the first `>` instead. This tool calls out greedy vs. lazy explicitly on every quantifier token specifically because this is the single most common source of "why did my regex match way more than I expected."