Regex Builder & Tester

Build, test, and debug regular expressions with real-time matching

Regular Expression

Test String

Common Patterns

Email
[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}
URL
https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&\/\/=]*)
Phone (US)
\(?[0-9]{3}\)?[-. ]?[0-9]{3}[-. ]?[0-9]{4}
IPv4
\b(?:(?: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]?)\b
Date (YYYY-MM-DD)
\d{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])
Time (HH:MM)
([01]?[0-9]|2[0-3]):[0-5][0-9]
Hex Color
#?([a-fA-F0-9]{6}|[a-fA-F0-9]{3})
Username
^[a-zA-Z0-9_-]{3,16}$
Password (strong)
(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[!@#\$%\^&\*])(?=.{8,})
Credit Card
\b(?:\d[ -]*?){13,16}\b
SSN
\b\d{3}-\d{2}-\d{4}\b
UUID
[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}

Match Results

No matches found

Quick Reference

. Any character
\d Digit (0-9)
\w Word character
\s Whitespace
^ Start of line
$ End of line
* 0 or more
+ 1 or more
? 0 or 1
{n} Exactly n
{n,} n or more
{n,m} Between n and m
[abc] Character set
[^abc] Negated set
(abc) Capturing group
a|b Alternation