coolregex.
fyi
Search regex
Press
⌘
K
Password Strength
at least 8 characters, one uppercase, one lowercase, one number, one special character
^
(?=.*[a-z])
(?=.*[A-Z])
(?=.*d)
(?=.*[@$!%*?&])
[A-Za-zd@$!%*?&]
{8,}
$
Email Address
Validates a typical email address.
^
[a-zA-Z0-9._%+-]
+
@
[a-zA-Z0-9.-]
+
.
[a-zA-Z]
{2,}
$
URL
Matches HTTP/HTTPS URLs.
^
https
?
://
(www.)
?
[a-zA-Z0-9.-]
+
.
[a-zA-Z]
{2,}
(/S*)
?
$
IP Address (IPv4)
Validates IPv4 addresses.
^
((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]?)
$
Hex Color
Matches hexadecimal color codes (#FFFFFF or #FFF).
^
#
([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})
$
Extracting HTML Tags
Matches and extracts HTML tags and their contents.
<
([a-zA-Z]+)
([^<]+)
*
(?:>(.*)
</\1>|s
+
/>)
Passport Number
Matches Passport Numbers.
^
[A-PR-WY]
[1-9]
ds
?
d
{4}
[1-9]
$
Slug
Matches slugs (strings with only lowercase letters, numbers, and hyphens).
^
[a-z0-9]
+
(?:-[a-z0-9]+)
*
$
Date (MM/DD/YYYY)
Matches dates in the format MM/DD/YYYY.
^
(0[1-9]|1[0-2])
/
([0-2][0-9]|3[01])
/d
{4}
$
Social Security Number
Matches US Social Security Numbers (SSN).
^
d
{3}
-d
{2}
-d
{4}
$
Phone Number
Matches US phone numbers with optional country code.
^
(\+\d{1,3}[- ]?)
?
(\d{3})
[- ]
?
\d
{3}
[- ]
?
\d
{4}
$
ZIP Code
Matches US ZIP codes with optional 4-digit extension.
^
d
{5}
(-d{4})
?
$
Currency
Matches currency amounts in dollars (e.g., $1,234.56).
^
[$]
?
[0-9,]
+
(.[0-9]{2})
?
$