Test regular expressions with live matching, highlighting, and capture groups. Real-time validation as you type.
Regular expressions are powerful but the syntax is dense enough that even experienced developers test patterns interactively rather than trusting their memory. Paste your pattern, paste your test string, and see exactly what matches — highlighted in real time.
| Pattern | Matches | Example |
|---|---|---|
\d |
Any digit 0–9 | \d{4} matches 2026 |
\w |
Word char (letter, digit, _) | \w+ matches hello_world |
\s |
Whitespace (space, tab, newline) | \s+ collapses multiple spaces |
. |
Any character except newline | c.t matches cat, cut, c9t |
^ $ |
Start / end of string | ^\d+$ matches strings of only digits |
* + ? |
0+, 1+, 0 or 1 occurrences | colou?r matches color and colour |
{n,m} |
Between n and m occurrences | \d{2,4} matches 2–4 digits |
[abc] |
Any of a, b, or c | [aeiou] matches any vowel |
[^abc] |
Anything except a, b, or c | [^0-9] matches non-digits |
(abc) |
Capture group | (\d{4})-(\d{2})-(\d{2}) captures date parts |
(?:abc) |
Non-capturing group | Groups without saving to $1, $2… |
# Email address
^[a-zA-Z0-9._%+\-]+@[a-zA-Z0-9.\-]+\.[a-zA-Z]{2,}$
# URL (http or https)
https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_+.~#?&\/=]*)
# IPv4 address
^((25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(25[0-5]|2[0-4]\d|[01]?\d\d?)$
# ISO 8601 date (YYYY-MM-DD)
^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$
# Hex color (#rgb or #rrggbb)
^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$
# Slug (lowercase, hyphens, no trailing dash)
^[a-z0-9]+(?:-[a-z0-9]+)*$
# Strong password (8+ chars, upper, lower, digit, special)
^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,}$
g — global: find all matches, not just the first onei — case-insensitive: hello matches Hello, HELLOm — multiline: ^ and $ match start/end of each line, not the whole strings — dotAll: . also matches newlines (not supported in all environments)Your test strings and patterns never leave your device. Safe to use with real log files, customer data, or proprietary formats.
JavaScript's built-in RegExp engine (ECMAScript regex). This matches the behaviour in browsers, Node.js, and most front-end frameworks. It does not support lookbehind in older Safari versions or some atomic groups found in PCRE (PHP, Python's re module).
A capturing group (abc) saves the matched text so you can reference it with $1, $2 in replacements or read it from match.groups[]. A non-capturing group (?:abc) groups the pattern for quantifiers or alternation but doesn't save the match. Use non-capturing groups when you don't need the captured value — it's slightly faster.
Different regex engines (PCRE, JavaScript, Python, .NET) have slightly different syntax. Features like lookbehind, named groups, and Unicode properties work differently across engines. This tester uses JavaScript's engine — results may differ in PHP, Python, or .NET.
Catastrophic backtracking happens when a regex with nested quantifiers (like (a+)+ or (a|aa)+) tries an exponential number of paths on a non-matching string. It can freeze a browser or crash a server. Avoid nested quantifiers on the same characters and test with long non-matching strings before deploying.
Escape it with a backslash. A literal dot is \. — without the backslash, . matches any character. Other characters that need escaping: \ ^ $ . | ? * + ( ) [ ] { }