Regex Explainer
Runs in your browser — your text is not sent anywhere to use this tool.
Save this tool
Keep Regex Explainer handy
Use your browser's Share menu, then “Add to Home Screen”.
A regex explainer: paste a pattern and read what every part of it does, in English.
- Paste your regular expression, with or without the slashes
- Read the breakdown from top to bottom
- Follow the indentation to see what each quantifier applies to
Flags
About this tool
A regex explainer takes a regular expression apart and describes each piece in ordinary words. Paste a pattern — with or without the surrounding slashes and flags — and you get an outline: what each token matches, how many times it can repeat, and which parts are captured. The thing that makes a regex unreadable is rarely the individual pieces. Most people know what \d is. What is genuinely hard to see is what applies to what: whether a plus sign repeats one character or a whole group, where an alternation begins and ends, and what a lookahead is actually looking at. So the explanation is nested, and the nesting is the point — indentation answers that question before any of the words do. It reads the pattern rather than running it. That means two useful things. A pattern that would take minutes to run against a hostile input is explained instantly, because reading it is a fraction of the work. And a pattern that does not compile still gets explained: if you have pasted something because it is broken, being told "SyntaxError" puts you back where you started, so problems are reported alongside the breakdown rather than instead of it. Nothing is sent anywhere. Patterns often carry hints about the data they were written for, and those stay in your browser.
Frequently asked questions
What does this regex mean?
Paste it in and read the outline. Each line names one piece of the pattern and says what it matches; indented lines are inside the group above them. If a quantifier like + or {2,4} applies to a piece, it is stated on the same line, which is the part people most often read wrongly.
Can I paste a pattern with the slashes and flags?
Yes. Both /\d+/gi and \d+ are understood. If flags are present they are listed with what each one does, since g, i, m and s change the behaviour of the pattern more than most of its characters do.
Does it explain a regex that does not work?
Yes, and that is deliberate. An unclosed bracket, a stray quantifier or an impossible count like {5,2} is reported as a problem, and the rest of the pattern is still explained. Being handed only an error message is no help when the reason you came was that the pattern is broken.
Is this the same as testing a regex?
No. This reads the pattern and tells you what it says; a tester runs it against text and shows you what it matched. They answer different questions and are often useful together — our regex tester is a click away.
Why does ab+ not repeat the whole thing?
Because a quantifier applies to the single item immediately before it, so ab+ is an a followed by one or more b. To repeat both you need a group: (ab)+. This is the single most common misreading of a regex, which is why the outline always shows a quantifier attached to exactly the piece it governs.
What is the difference between a capture group and (?:...)?
A capture group keeps what it matched so you can refer to it afterwards, by number or by name. (?:...) groups characters together for structure — so a quantifier or an alternation can apply to all of them — without keeping the result. Using a non-capturing group where you do not need the value keeps the numbering of the rest tidy.
Help improve this tool
Found a bug, want a change, or need a tool we don't have?
You have an unsent draft.
Thanks — that's with us. You'll find the reply in your inbox.Go to my messages