Regex Explainer

Turn a cryptic regular expression into a plain-English, token-by-token breakdown with a live match preview.

Pattern

Explanation

  1. ^the start of the string (or line in multiline mode)
  2. (?<year>start of a named capturing group "year"
  3. \dany digit (0-9)
  4. {4}the preceding token, repeated exactly 4 time(s)
  5. )end of the group
  6. -the literal character "-"
  7. (start of a capturing group
  8. \dany digit (0-9)
  9. {2}the preceding token, repeated exactly 2 time(s)
  10. )end of the group
  11. -the literal character "-"
  12. (start of a capturing group
  13. \dany digit (0-9)
  14. {2}the preceding token, repeated exactly 2 time(s)
  15. )end of the group
  16. $the end of the string (or line in multiline mode)

Live match preview

2026-07-07 and 2025-01-15 are ISO dates

0 matches found

About this tool

Reading a dense regular expression is often harder than writing one — a pattern like ^(?<year>\d{4})-(\d{2})-(\d{2})$ hides its meaning behind terse metacharacters. This explainer walks the pattern token by token and describes each piece in plain English, so you can understand exactly what a regex matches without running it in your head.

It parses anchors, character classes and their ranges, shorthand classes like \d and \w, capturing/non-capturing/named groups, lookahead and lookbehind assertions, alternation, and quantifiers including lazy variants. Alongside the explanation, a live match preview runs your pattern against sample text and highlights every match and capture group, and a library of common patterns (email, URL, IPv4, hex colour, ISO date, slug and more) gives you a vetted starting point. Everything is parsed and matched locally with the browser's own RegExp engine.

How to use

  1. Paste a pattern

    Enter a regular expression, with or without the surrounding slashes and flags.

  2. Read the breakdown

    Each token is listed with a plain-English description of what it matches.

  3. Test against sample text

    Type test text to see every match highlighted and the first match's capture groups.

  4. Start from a common pattern

    Insert a vetted pattern from the library, read its explanation, then adapt it.

What it explains

ConstructExample
Anchors^ start, $ end, \b word boundary
Shorthand classes\d digit, \w word char, \s whitespace
Character classes[a-z0-9], [^abc] (negated)
Groups(...), (?:...), (?<name>...)
Assertions(?=...), (?!...), (?<=...), (?<!...)
Quantifiers*, +, ?, {n,m}, and lazy variants (*?)

Parsing and matching run in your browser via the native RegExp engine.

Frequently asked questions