Regex Tester

Test and debug regular expressions with live matching, highlighting, and common pattern examples.

/ /
No matches
Text with Highlighted Matches:
Enter a regex pattern and test text to see matches highlighted.

Common Regex Patterns

Email

[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}

Matches most email address formats

URL

https?://(?:[-\w.])+(?:\:[0-9]+)?(?:/(?:[\w/_.])*)?(?:\?(?:[\w&=%.])*)?(?:\#(?:[\w.])*)?

Matches HTTP and HTTPS URLs

Phone (US)

^\(?([0-9]{3})\)?[-. ]?([0-9]{3})[-. ]?([0-9]{4})$

Matches US phone number formats

IP Address

^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$

Matches IPv4 addresses

Date (MM/DD/YYYY)

^(0[1-9]|1[0-2])\/(0[1-9]|[12][0-9]|3[01])\/\d{4}$

Matches MM/DD/YYYY date format

Hex Color

^#?([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$

Matches hex color codes

Regex Flags Explained

g (global): Find all matches, not just the first one
i (ignore case): Case-insensitive matching
m (multiline): ^ and $ match start/end of lines, not just string
s (dotall): . matches newline characters
u (unicode): Enable full Unicode support
y (sticky): Match from exact position in string

Basic Regex Syntax

. Matches any character except newline
* Matches 0 or more of the preceding character
+ Matches 1 or more of the preceding character
? Matches 0 or 1 of the preceding character
^ Matches start of string
$ Matches end of string
[] Character class - matches any character inside
() Capturing group
| Alternation (OR)
\d Matches any digit (0-9)
\w Matches any word character (a-z, A-Z, 0-9, _)
\s Matches any whitespace character