BizTechLab

IDEASINNOVATIONIMPACT

Regex

Regex Explainer

Paste a pattern to see it broken down token by token in plain English, with nested groups shown as indentation. Runs entirely in your browser; nothing you type is ever sent anywhere.

//
Enter a pattern above to break it down token by token.

Quick Learn

Reading someone else's regex — or your own from six months ago — usually means squinting at a wall of symbols and mentally simulating what each piece does. A pattern like ^(?<user>[\w.+-]+)@(?<domain>[\w-]+\.[a-zA-Z]{2,})$ is really just several small, ordinary rules stacked together: start of string, one or more word/dot/plus/dash characters, an @, more characters, a literal dot, then letters — the density is what makes it hard to read, not the individual pieces.

This tool walks a pattern left to right and explains each piece in plain English, using JavaScript's own regex parser to catch invalid syntax first. Groups are indented under the parenthesis that opens them, so nested structure is visible at a glance instead of buried in brackets. Everything runs locally in your browser.

Best Practices

  • Read top to bottom, not left to right in your head — the token list already did the left-to-right parsing for you; scanning it top to bottom is usually faster than re-parsing the raw pattern yourself.
  • Pay attention to which token a quantifier attached to — a common source of "why does this match more than I expected" is a quantifier landing on a single character instead of the group you meant it to repeat.
  • If a pattern you wrote doesn't explain the way you expected, that's often the bug itself — trust the breakdown over your mental model of what you thought you wrote.
  • Named groups explain themselves ("a named capturing group 'user'") far better than numbered ones — worth converting a pattern's groups to named ones before sharing it with someone else.

More Regex Tools

See all Regex tools

Frequently Asked Questions

No. The pattern is parsed and explained entirely in your browser — nothing you type is sent to a server or stored anywhere.

Want the engineering deep-dives behind tools like this one?