Skip to main content

Regex Tester & Explainer

Runs locally

Test JS regex with live match highlights, capture groups, AST explanation, worker guard and code export.

What is Regex Tester & Explainer?

Test ECMAScript regular expressions with live color-coded match highlighting, numbered and named capture groups, token-by-token plain-English explanations via regexp-tree AST, replace/split previews, multi-line pass/fail checks, catastrophic backtracking timeout protection, and escaped code export for 10 languages.

How to use Regex Tester & Explainer

  1. Step 1

    Enter your regex pattern and toggle flags (g, i, m, s, u, v, y, d).

  2. Step 2

    Paste test text or switch to Multi-line Pass/Fail mode to verify multiple cases at once.

  3. Step 3

    Inspect highlighted matches, capture groups, and the plain-English token explanation.

  4. Step 4

    Check any catastrophic backtracking warnings — execution runs in a Web Worker with a timeout guard.

  5. Step 5

    Export properly escaped code snippets for JavaScript, TypeScript, Python, Go, Kotlin, Swift, Java, PHP, C#, or Ruby.

Features

  • Live match highlighting with distinct capture group pills (named & numbered)
  • Token-by-token plain-English pattern explanation parsed via regexp-tree AST
  • Worker timeout guard + static nested-quantifier warning to prevent ReDoS freezes
  • Replace mode ($1, $<name>), Split mode, and Multi-line test suite
  • Curated library of common patterns (email, URL, IPv4/IPv6, UUID, semver, JWT) with accuracy notes
  • Multi-language code export with language-accurate string escaping

Example

Input

Pattern: (?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2}) | Text: Released 2026-11-28

Output

Match: "2026-11-28" | Groups: year="2026", month="11", day="28"

Named capture groups extract date parts cleanly and can be referenced as $<year> in Replace mode.

Frequently asked questions

Which regex flavour does this use?

The JavaScript engine of your browser. Other languages differ in syntax for lookbehind, named groups, possessive quantifiers and flags, so check the differences note before copying a pattern.

Why does my pattern work here but not in my code?

Usually flags, escaping in string literals, or flavour differences. Use Code export to get a correctly escaped snippet.

What is catastrophic backtracking?

A pattern that takes exponential time on certain inputs, such as nested quantifiers. The tester warns when a pattern looks risky or runs too long.

How do I use named groups?

Write (?<name>...) and reference it as $<name> in replacements.

Are my test strings uploaded?

No. Everything runs in your browser.