Regular Expression (RegEx) Tester & Matcher

Build, test, and debug regular expressions with flag toggles (g, i, m, s, u), capture groups inspection, substitution with backreferences, and a curated library of common patterns.

Ready Presets:
Flags:
//gm
Test String3 match(es)
Match #1pos: 30..44 (14 chars)
123.456.789-01
Capture Groups:
$1:123
$2:456
$3:789
$4:01
Match #2pos: 60..71 (11 chars)
98765432100
Capture Groups:
$1:987
$2:654
$3:321
$4:00
Match #3pos: 89..103 (14 chars)
000.111.222-33
Capture Groups:
$1:000
$2:111
$3:222
$4:33

How to Use

01

Enter your regex pattern or select one of the ready presets.

02

Toggle active search flags (g, i, m, s, u) using the quick buttons.

03

Paste test text to see highlighted matches and capture groups computed in real time.

04

Switch to the "Substitution / Replace" tab to test pattern replacement.

What Is This Tool?

A Regular Expression (Regex) is a sequence of characters that forms a search pattern for text validation, extraction, and string transformation in software engineering.

Why It Matters

Regexes are essential in web development. Testing patterns against sample strings prevents subtle bugs and edge-case errors before deploying to production.

How Does the Substitution (Replace) Tab Work?

The Substitution tab lets you test replacing matches found in your text with a formatted string. Use variables like $1 and $2 to reorder capture groups defined in parentheses (), $& to re-insert the entire matched text, or static text like masks [REDACTED].

What Are Capture Groups ($1, $2)?

When you enclose parts of your regex in parentheses (e.g., (\d{4})-(\d{2})-(\d{2})), each pair of parentheses creates a numbered capture group ($1 for year, $2 for month, $3 for day). In the replacement pattern, referencing $3/$2/$1 immediately reformats dates and numbers.

Developer Tip
Avoid nested repetitive quantifiers in complex patterns to protect your servers from catastrophic backtracking (ReDoS).

Frequently Asked Questions