Test regular expressions with live match highlighting, group capture and replace mode
Test, debug and validate regular expressions in real time. Type your pattern and test string — matches highlight instantly. View every match with its position and captured groups. Use replace mode to test substitutions. Includes a cheat sheet and one-click common patterns.
Matches are highlighted in real time as you type — both in the test string view and in the match list below.
All capture groups (numbered and named) are extracted and shown for each match with their values.
Test find-and-replace operations with backreferences ($1, $2) and see the full result after substitution.
Toggle g, i, m, s flags with checkboxes — no need to remember syntax. Each flag is explained by tooltip.
One-click patterns for email, URL, date, IPv4, hex color and more — click any to load it instantly.
Quick reference sidebar covering all essential regex tokens — always visible while you work.
When writing a regex for validation (e.g. email, phone, postcode), always anchor it with ^ at the start and $ at the end. Without anchors, a pattern like \d+ would match any string containing a digit — including "abc123xyz". With anchors, ^\d+$ only matches strings that are entirely digits.
| Token | Meaning | Example | Matches |
|---|---|---|---|
. | Any character (except newline) | c.t | cat, cut, c3t |
\d | Digit [0-9] | \d{3} | 123, 007, 999 |
\w | Word character [a-zA-Z0-9_] | \w+ | hello, foo_bar |
\s | Whitespace (space, tab, newline) | \s+ | spaces, tabs |
^ | Start of string (or line with m flag) | ^Hello | Hello at start |
$ | End of string (or line with m flag) | world$ | world at end |
* | 0 or more repetitions (greedy) | ab* | a, ab, abbb |
+ | 1 or more repetitions (greedy) | ab+ | ab, abbb |
? | 0 or 1 (optional) | colou?r | color, colour |
{n,m} | Between n and m repetitions | \d{2,4} | 12, 123, 1234 |
(abc) | Capture group | (\d+) | captures digits |
(?:abc) | Non-capture group | (?:ab)+ | ab, abab |
[abc] | Character class | [aeiou] | any vowel |
[^abc] | Negated class | [^aeiou] | any consonant |