RootUtils

Regex Explainer

Client-Side Secure

Free Regex Explainer (Regex to English) for JavaScript RegExp. Break down tokens, validate flags, preview matches, and export/share patterns — runs client-side.

Regex Explainer

Regex to English + Quick Match Preview (JavaScript RegExp).

//
Normalized: gm
Open Regex Tester

Explanation

16 token(s)
^
anchor01

Start of string/line

(
group12

Start of capturing group

[a-z0-9_\.-]
set214

Character set: any of these characters

+
quantifier1415

1 or more (greedy)

)
group1516

End of group

@
literal1617

Literal character "@"

(
group1718

Start of capturing group

[\da-z\.-]
set1828

Character set: any of these characters

+
quantifier2829

1 or more (greedy)

)
group2930

End of group

\.
literal3032

Escaped character "."

(
group3233

Start of capturing group

[a-z\.]
set3340

Character set: any of these characters

{2,6}
quantifier4045

Quantifier: repeats 2,6 time(s)

)
group4546

End of group

$
anchor4647

End of string/line

Quick Test

Preview
Matches: 2
Match #1idx 0
john.doe@example.com
$1: john.doe
$2: example
$3: com
Match #2idx 21
jane_smith@test.co
$1: jane_smith
$2: test
$3: co

Flags

  • gGlobal (find all matches)
  • iCase-insensitive
  • mMultiline (^ and $ match lines)
  • sDotAll (.) matches newlines
  • uUnicode mode
  • ySticky (match at lastIndex)

Tip

Use capturing groups (...) to extract parts of a match. In JavaScript, groups appear as $1, $2 in replacements, and as array entries in match[1], match[2], etc.

Is this tool broken?

Let us know if you found a bug or have a feature request.

Regex Explainer (Regex to English) for JavaScript RegExp

This tool converts a JavaScript regular expression into a step-by-step explanation. It tokenizes common regex parts (anchors, groups, character sets, quantifiers, escapes, alternation) and presents them in plain English so you can review what your pattern is doing.

Everything runs client-side in your browser. Your regex and sample text are not sent to a server by this page.

What makes this Regex Explainer different

  • Token ranges + hover highlight: hover a token and we select that exact segment in the regex input for fast debugging.
  • Mini match preview: quickly test your regex against sample text and inspect capture groups without leaving the explainer.
  • Compatibility notes: we warn about some non-JS/PCRE-only constructs and features that can fail in older engines.
  • ReDoS heuristic: highlights patterns that are commonly associated with catastrophic backtracking. (This is a best-effort warning, not a proof.)
  • Share links + exports: generate a link to reproduce a regex/flags combo, and export your explanation as JSON/Markdown.

Common JavaScript regex tokens

Character classes

  • \d digit, \D non-digit
  • \w word char, \W non-word
  • \s whitespace, \S non-whitespace
  • [abc] set, [^abc] negated set

Quantifiers & anchors

  • * 0+ , + 1+ , ? optional
  • {n,m} bounded repetition
  • ^ start, $ end
  • | alternation (OR)

Notes on safety and correctness

Regex explanation is inherently best-effort: different regex engines support different features. This tool targets JavaScript RegExp. The “ReDoS risk” indicator is a heuristic warning based on common backtracking pitfalls—use it as a prompt to review and test, not as a guarantee.