Regex Tester
Test regular expressions with live matches, capture groups, and replacements. Run locally or via Django API.
Flags:
Presets:
Supported:
$& entire match, $1…$99 capture groups, $$ literal dollar.
Tip: Ctrl/Cmd+Enter runs the test.
Matches & Replace Preview
Idle
Capture Groups
| # | Match | Index | Groups |
|---|
Regular Expressions — A Practical Guide
Regular expressions (regex) describe text patterns for validation, extraction, and search/replace. Use anchors for validation, and test on realistic samples.
Common tokens
.any char (addsfor dotall)\\d \\w \\sdigits/word/space^ $line anchors (mflag)(...)capture,(?:...)non‑capture[abc]class,[^abc]negated
Useful patterns
- Email:
^[\\w.%+-]+@[\\w.-]+\\.[A-Za-z]{2,}$ - URL:
https?:\\/\\/[\\w.-]+(?:\\/[\\w./%#?=&-]*)? - IPv4:
\\b\\d{1,3}(?:\\.\\d{1,3}){3}\\b
Pitfalls & tips
- Watch for catastrophic backtracking; simplify where possible.
- Use
ufor Unicode andsfor multiline dot. - Benchmark on long inputs; the API enforces timeouts for safety.
Replacement Cheatsheet
$&= full match$1 … $99= capture groups$$= literal “$”
Example
Pattern: (\\d{4})-(\\d{2})-(\\d{2})
Replace: $3/$2/$1
Input: 2025-08-19 → Output: 19/08/2025