How to use the Regex Explainer
- Paste a regex (with or without /slashes/ and flags).
- Read the explanation for each token.
- Try the examples to learn common patterns.
What does this tool do?
Regular expressions are compact but cryptic. The explainer splits a pattern into tokens — anchors, character classes, groups, quantifiers and escapes — and describes what each one matches, indenting the contents of groups.
It also checks the pattern with your browser's regex engine and reports syntax errors. Test it against real text with the Regex Tester.
Why use it?
- Plain-English breakdown.
- Groups shown as nesting.
- Syntax check included.
Use cases
- Understand a regex someone else wrote.
- Review validation patterns before shipping them.
- Learn regex syntax step by step.
^\d{3}-\d{4}$ in plain English
^ start of the text · \d{3} exactly three digits · - a hyphen · \d{4} exactly four digits · $ end of the text. It matches “555-1234” but not “555-12345”.
Common mistakes
- Forgetting ^ and $, so the pattern matches part of a longer string.
- Using greedy .* where a lazy .*? was intended.
- Not escaping dots — . matches any character.
Privacy
The calculation happens instantly in your browser. The numbers you enter are not sent to our servers or saved. There's no account to create and nothing to install.
Frequently asked questions
Which regex flavour does it use?
JavaScript's, through your browser's own regex engine.
Can I paste /pattern/flags?
Yes, slashes and flags are recognised.
How do I test it on real text?
Use the Regex Tester to see the matches live.
Content last updated . See how M2Toolkit works.