How regex explainer works
A regular expression is a string of tokens that a regex engine interprets as a search pattern. This explainer walks your pattern from left to right and splits it into its constituent tokens — literal characters, escapes like \d and \w, character classes in square brackets, anchors like ^ and $, groups, quantifiers like * and {2,4}, and the alternation |.
Each token is labelled with its type and given a one-line plain-English description, so a pattern such as ^[A-Z]\w+@\w+\.\w+$ reads as "start of string, an uppercase letter, one or more word characters, an @, one or more word characters, a dot, one or more word characters, end of string." Quantifiers report whether they are greedy or lazy and their min and max.
The pattern is first validated by constructing a RegExp from it, so an unbalanced parenthesis or invalid escape returns a clear error instead of a partial explanation. The flags are decoded too (g global, i case-insensitive, m multiline, s dotAll, u unicode, y sticky). Everything runs in your browser.
Frequently asked questions
How is this different from the regex tester?
The regex tester runs your pattern against a string and shows the matches. This explainer does not run the pattern — it parses the pattern itself and explains what each token means in plain English, which helps you read a regex you did not write.
Does it support lookbehind and named groups?
Yes. It recognises capturing and non-capturing groups, positive and negative lookahead, positive and negative lookbehind, and named capturing groups using the (?<name>…) syntax, labelling each accordingly.
What are greedy and lazy quantifiers?
A greedy quantifier (*, +, ?, {n,m}) matches as much as possible. Adding a trailing ? makes it lazy (non-greedy), so it matches as little as possible. The explainer flags which one each quantifier is.
Why does it say my regex is invalid?
Before explaining, the tool builds a RegExp from your pattern and flags. If that throws — for example an unbalanced parenthesis, a dangling backslash, or an invalid quantifier — it returns the engine’s error message instead of a partial token list.