Skip to content

Menu

Regex Explainer

Explain regex patterns in plain English

Runs entirely in your browserText & DiffFree, no sign-up
Loading tool

01What is Regex Explainer?

Paste a regular expression and the explainer walks through it left to right, building a numbered Token Breakdown table with a plain-English line for each piece. It is the tool to reach for when you inherit a validation pattern nobody remembers writing. The parser is hand-written for JavaScript regex syntax as described in MDN's regular expressions guide. It recognizes \d, \w, \s and their negations, \b word boundaries, \n, \t, \r, \f, \v and \0. Hex and Unicode escapes like \x41 and \u00e9 are shown with the character they stand for, and control escapes like \cJ are named as Ctrl+J. It also handles numbered and named backreferences such as \1 and \k<name>, escaped literals, character classes including negated ones and simple ranges, the dot, the anchors ^ and $, and alternation with |. Quantifiers *, +, ? and the counted forms {n}, {n,} and {n,m} are each marked greedy, or lazy when followed by a ?. Groups get one row each, and the explanation walks through the contents as a single sentence. Capture groups are numbered by the order of their opening parentheses, and named groups show their name. Non-capturing groups, lookaheads and lookbehinds are labelled as such. Here is a real run. The pattern (?<=\$)\d+(\.\d{2})? produces five rows. The first reads "positive lookbehind (preceded by): a literal '$'". Then comes \d as a digit, + as one or more times, and the group as "capture group 1: a literal dot, then a digit (0-9), then exactly 2 times". The trailing ? is listed as optional. Add a Test String and the pattern is compiled with JavaScript's own RegExp using the g flag. Every match is highlighted inline and a counter shows how many were found. If the engine rejects the pattern, you see its error message instead. Copy Explanation exports the table as token => explanation lines, ready for a pull request comment. Now the limits. You cannot set flags, so i, m, s and u are never applied. Without u, \p{L} is not treated as a Unicode property. Long group explanations can get wordy, since every literal letter becomes its own phrase. Other flavours, such as PCRE possessive quantifiers or Python's (?P<name>) syntax, are not explained. The parsing and matching run in your browser, so the pattern and test text never leave the page.

Developers and QA engineers use it to read an unfamiliar regular expression token by token and test it against sample text. The tool runs entirely in your browser, so your data never leaves your device.

02How to use Regex Explainer

  1. Enter the expression in Regex Pattern without surrounding slashes or flags
  2. Read the Token Breakdown table row by row
  3. Type or paste sample text into Test String
  4. Check Highlighted Matches and the match count
  5. Click Copy Explanation to share the breakdown, or Reset to start over

03Worked examples

Input: ^\d{3}-\d{4}$
Result: ^ start of string; \d a digit (0-9); {3} exactly 3 times; - literal '-'; \d a digit (0-9); {4} exactly 4 times; $ end of string
Input: (?<year>\d{4})-(\d{2})
Result: (?<year>\d{4}) capture group 1 named "year": a digit (0-9), then exactly 4 times; - literal '-'; (\d{2}) capture group 2: a digit (0-9), then exactly 2 times
Named groups are still numbered.
Input: a+?b
Result: a literal 'a'; +? one or more times, as few as possible (lazy); b literal 'b'
The ? after a quantifier makes it lazy instead of optional.
Input: [^aeiou]\s*
Result: [^aeiou] any character except: aeiou; \s a whitespace character (space, tab, line break, or other Unicode space); * zero or more times, as many as possible
Input: (?:foo|bar)\b
Result: (?:foo|bar) non-capturing group: literal 'f', then literal 'o', then literal 'o', then OR, then literal 'b', ...; \b a word boundary
The group sentence is trimmed after the first letter of bar.
Input: \x41\u00e9\cJ
Result: \x41 the character U+0041 ('A'); \u00e9 the character U+00E9 ('é'); \cJ the control character Ctrl+J

04Common use cases

  • Decoding a validation regex inherited in a legacy form handler before changing it
  • Pasting a token-by-token breakdown into a pull request comment for a reviewer
  • Checking which parts of a sample log line a pattern actually matches
  • Learning regex syntax by comparing each token with what it highlights
  • Spotting that a ? after a quantifier makes it lazy rather than optional
  • Confirming the group numbers before using $1 or $2 in a String.replace call

05Tips

  • A long group's explanation gets wordy. Paste the group's inner pattern on its own to see it as separate rows.
  • Matching only uses the g flag. Case-insensitive or multiline behaviour will not show up in the highlights.
  • Named groups still count in the numbering, so (?<year>\d{4})-(\d{2}) makes the second group number 2.
  • Lookbehind support differs between regex engines, so a pattern that works here may fail in another language.
  • Watch for nested quantifiers like (a+)+. They can cause catastrophic backtracking on long input that does not match.

06Related concepts

regular expressions, quantifiers, capture groups, lookahead, character classes.

Frequently Asked Questions

What is Regex Explainer?

Regex Explainer is a free, browser-based developer tool on AIDToolStack. Explain regex patterns in plain English It requires no installation or sign-up and works entirely in your browser.

Is Regex Explainer free to use?

Yes. No sign-up, no fees and no usage cap.

Does Regex Explainer store my data?

No. It runs in your browser; nothing is uploaded.

Cheat sheet

Reviews and commentsShow

Reviews

Sign in to leave a review.

Loading reviews…

Comments

Sign in to leave a comment.

Loading comments…

What changed in AI dev tools, once a month

Renames, shutdowns, pricing changes and new MCP setups, each with a source.

Subscribe