This pattern has 2 capturing groups with 2 flags (gi) and is broken down into 14 parts below.
Flags
gglobal - find all matches in the input, not just the first oneiignore case - letters match regardless of upper or lower case^Start-of-string anchor (or start of a line with the m flag)(?<user>Start of a named capturing group "user" - saves its match under that name[a-z0-9._%+-]A single character from the set: the range "a" to "z", the range "0" to "9", the character ".", the character "_", the character "%", the character "+", the character "-"+Repeated one or more times)End of the group@A literal "@" character(?<domain>Start of a named capturing group "domain" - saves its match under that name[a-z0-9.-]A single character from the set: the range "a" to "z", the range "0" to "9", the character ".", the character "-"+Repeated one or more times\.A literal "." character (the backslash removes its special meaning)[a-z]A single character from the set: the range "a" to "z"{2,}Repeated 2 or more times)End of the group$End-of-string anchor (or end of a line with the m flag)
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.
Enter the pattern without the surrounding slashes - just the expression itself. Click Load Sample to start from a worked email-matching example.
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.
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.
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.
Every anchor, character class, quantifier, group, and escape gets its own line with a description, in the order the engine reads them
Capturing, non-capturing, named groups, and all four lookaround types are labelled and indented so nested structure is easy to follow
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
Patterns are validated with the browser native RegExp engine, so an invalid expression is caught with the exact error before you rely on it
Extract email addresses, URLs, phone numbers, and IPv4 addresses from any block of text. De-duplicate, sort, and copy the results. Runs client-side.
Find and replace text with a regular expression, using capture group backreferences like $1 and named groups, with full flag support
Test regular expressions against sample text with live match highlighting, capture groups, and full flag support
Build, test, and debug regular expressions with real-time matching and a comprehensive cheatsheet
0 comments
No comments yet. Be the first to share your thoughts!