Command Palette

Search for a command to run...

RE

Regex Explainer

Paste a regular expression and get a clear, token-by-token explanation in plain English, including flags, groups, and quantifiers.

What is a Regex Explainer?

A Regex Explainer takes a regular expression and translates it into plain English, one construct at a time. Instead of squinting at a dense line like ^(?<user>[a-z0-9._%+-]+)@... you get a labelled breakdown: this part is an anchor, this is a named capturing group, this character class means "a lowercase letter, a digit, a dot, or a hyphen", and this quantifier means "one or more times". It turns a wall of symbols into a checklist you can read.

Regular expressions are compact by design, which makes them powerful but hard to review. The same pattern can be written many ways, and a single stray backslash or a greedy quantifier changes the meaning completely. Reading an unfamiliar regex - in a code review, an old config file, or a Stack Overflow answer - usually means mentally simulating the engine. This tool does that simulation for you and shows the result as an ordered, indented list that mirrors the structure of the pattern, including nested groups and lookarounds.

Everything runs client-side on the same JavaScript RegExp engine your code uses, so the flag behaviour and validity you see here match production. Your pattern is never uploaded, nothing is logged, and the tool keeps working offline once the page has loaded. That matters when the regex you are trying to understand comes from a private codebase or matches sensitive data formats.

The explainer tells you what a pattern says, not whether it is the right pattern for your data - to check that, run it against real input in the Regex Tester. Because it compiles with the browser's own engine, constructs that exist in PCRE but not in ECMAScript behave in two different ways. Possessive quantifiers such as a++, atomic groups (?>...) and recursion (?R) are rejected outright, with the engine's own message. The subtler case is \A and \z: without the u flag JavaScript treats them as identity escapes, so a pattern copied from PHP or Python is explained as matching a literal A or z rather than a string boundary, and no error is raised. Nested quantifiers like (a+)+ are described normally too; catastrophic backtracking is a runtime property of the input, not something visible in the structure.

How to use the Regex Explainer?

  1. Paste your regular expression

    Enter the pattern without the surrounding slashes - just the expression itself. Click Load Sample to start from a worked email-matching example.

  2. Set the flags

    Toggle the flags the pattern uses (g, i, m, s, u, y, d). The explainer reports what each flag does and validates the pattern against that flag combination.

  3. Read the breakdown

    Each token is listed in order with a plain-English description. Nested groups are indented so the structure of the pattern is visible at a glance.

  4. Copy the explanation

    Copy the full plain-text breakdown to paste into a code comment, a pull-request note, or documentation so the next reader does not have to decode it.

Key Features

  • Token-by-Token Breakdown

    Every anchor, character class, quantifier, group, and escape gets its own line with a description, in the order the engine reads them

  • Group and Lookaround Aware

    Capturing, non-capturing, named groups, and all four lookaround types are labelled and indented so nested structure is easy to follow

  • Flag Explanations

    The g, i, m, s, u, y, and d flags are each described in context, so you understand how they change the whole match, not just the syntax

  • Real Engine Validation

    Patterns are validated with the browser native RegExp engine, so an invalid expression is caught with the exact error before you rely on it

Frequently Asked Questions

Paste the pattern into the explainer and read the token-by-token breakdown, which describes each construct in plain English in the order the engine applies it. Nested groups are indented so you can see the structure. This turns mentally simulating the engine into simply reading a labelled list.

Comments

0 comments

0/2000 characters

No comments yet. Be the first to share your thoughts!

regex explainerexplain regexregex to englishregex decoderwhat does this regex doregular expression explainedregex breakdownunderstand regexregex cheat sheet