Regex Library
Patterns
30
in library
Categories
10
visible
Visible
30
all
Total cats
10
in library
pattern · name + regex
Email (2)
Email (basic)
/^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}$/Email (RFC-ish)
/^(?:[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?)$/URLs (2)
URL (http/https)
/^https?:\/\/(?:[\w-]+\.)+[\w-]{2,}(?::\d+)?(?:\/[^\s]*)?$/URL (any scheme)
/^[a-zA-Z][a-zA-Z0-9+.-]*:\/\/[^\s]+$/IP / network (2)
IPv4 address
/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/IPv6 address
/^(?:[A-Fa-f0-9]{1,4}:){7}[A-Fa-f0-9]{1,4}$|^::(?:[A-Fa-f0-9]{1,4}:){0,6}[A-Fa-f0-9]{1,4}$|^[A-Fa-f0-9:]+::[A-Fa-f0-9:]*$/Date / time (3)
ISO 8601 date
/^\d{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[12]\d|3[01])$/ISO 8601 datetime
/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:?\d{2})$/24-hour time
/^(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d)?$/Identifiers (6)
MAC address
/^(?:[0-9A-Fa-f]{2}[:-]){5}[0-9A-Fa-f]{2}$/UUID v1-v5
/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89ABab][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$/ISBN-13
/^97[89]-?\d{1,5}-?\d{1,7}-?\d{1,7}-?\d$/ISBN-10
/^\d{1,5}-?\d{1,7}-?\d{1,6}-?[\dXx]$/US ZIP code
/^\d{5}(?:-\d{4})?$/UK postcode
/^[A-Z]{1,2}\d[A-Z\d]? ?\d[A-Z]{2}$/iColors (2)
Hex color
/^#(?:[0-9A-Fa-f]{3}|[0-9A-Fa-f]{4}|[0-9A-Fa-f]{6}|[0-9A-Fa-f]{8})$/rgb()/rgba()
/^rgba?\(\s*\d{1,3}\s*,\s*\d{1,3}\s*,\s*\d{1,3}(?:\s*,\s*(?:0|1|0?\.\d+))?\s*\)$/Numbers (2)
Integer
/^-?\d+$/Float
/^-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/Phone (2)
Phone (E.164)
/^\+[1-9]\d{1,14}$/Phone (US)
/^\+?1?[\s.-]?\(?([2-9][0-8]\d)\)?[\s.-]?([2-9]\d{2})[\s.-]?(\d{4})$/Credit cards (4)
Credit card — Visa
/^4[0-9]{12}(?:[0-9]{3})?$/Credit card — Mastercard
/^(?:5[1-5][0-9]{14}|2(?:2(?:2[1-9]|[3-9]\d)|[3-6]\d{2}|7(?:[01]\d|20))\d{12})$/Credit card — Amex
/^3[47][0-9]{13}$/Credit card — Discover
/^6(?:011|5[0-9]{2})[0-9]{12}$/Other (5)
URL slug
/^[a-z0-9]+(?:-[a-z0-9]+)*$/Username
/^[A-Za-z][A-Za-z0-9_-]{2,29}$/Strong password
/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[^A-Za-z0-9]).{12,}$/HTML tag
/<\/?[a-zA-Z][a-zA-Z0-9]*(?:\s+[^>]*?)?\/?>/gMarkdown link
/\[([^\]]+)\]\(([^)]+)\)/gdetails · description + sample
Email
Pragmatic email validator.
sample:
alice@example.comCloser-to-RFC email.
sample:
user.name+tag@sub.example.co.ukURLs
Match http(s) URLs.
sample:
https://example.com/path?q=1Any RFC 3986-ish URI.
sample:
ftp://files.example.com/IP / network
Dotted-quad IPv4.
sample:
192.168.1.1Common IPv6 forms.
sample:
fe80::1ff:fe23:4567:890aDate / time
YYYY-MM-DD.
sample:
2026-05-18Datetime with offset or Z.
sample:
2026-05-18T12:34:56ZHH:MM(:SS), 24-hour.
sample:
23:59Identifiers
EUI-48 MAC.
sample:
AA:BB:CC:DD:EE:FFHex UUID with version+variant nibbles.
sample:
550e8400-e29b-41d4-a716-446655440000Modern 13-digit ISBN, optional dashes.
sample:
978-3-16-148410-0Legacy 10-digit ISBN.
sample:
0-306-40615-2ZIP or ZIP+4.
sample:
94110-1234UK postcode.
sample:
SW1A 1AAColors
#rgb, #rgba, #rrggbb, #rrggbbaa.
sample:
#ff8800ccCSS rgb/rgba.
sample:
rgba(255, 136, 0, 0.8)Numbers
Optionally negative integer.
sample:
-42Decimal with optional exponent.
sample:
-1.23e10Phone
International E.164 format.
sample:
+14155551234US phone with optional country code.
sample:
(415) 555-1234Credit cards
Visa PAN.
sample:
4111111111111111Mastercard PAN.
sample:
5500000000000004Amex PAN.
sample:
340000000000009Discover PAN.
sample:
6011000000000004Other
Lowercase, hyphen-separated.
sample:
my-cool-postLetters, digits, _, -. 3–30 chars, must start with letter.
sample:
alice_99≥12 chars, upper+lower+digit+symbol.
sample:
Hunter2!Strong42Best-effort tag matcher (HTML is not regular).
sample:
<a href="x">link</a>[text](url) with capture groups.
sample:
[home](/index)