A collection of tested, commonly-used regular expressions. Browse patterns for emails, URLs, dates, phone numbers, and more. Click any pattern to test it.
Validates standard email addresses
^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$Validates HTTP/HTTPS URLs
^https?:\/\/(?:www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b(?:[-a-zA-Z0-9()@:%_\+.~#?&\/=]*)$Validates domain names
^(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$URL-friendly slug format
^[a-z0-9]+(?:-[a-z0-9]+)*$Validates UUID v4 format
^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$Validates hex color codes
^#?([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$Validates MAC addresses
^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$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]?)$Validates full IPv6 addresses
^(?:[a-fA-F0-9]{1,4}:){7}[a-fA-F0-9]{1,4}$Validates port numbers (0-65535)
^(?:[0-9]{1,4}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5])$ISO 8601 date format (YYYY-MM-DD)
^\d{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[12]\d|3[01])$24-hour time format
^(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d)?$Full ISO 8601 datetime
^\d{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[12]\d|3[01])T(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|[+-](?:[01]\d|2[0-3]):[0-5]\d)?$Positive or negative integers
^-?\d+$Decimal numbers with optional sign
^-?\d*\.?\d+$Percentage values (0-100)
^(?:100(?:\.0+)?|\d{1,2}(?:\.\d+)?)%?$Min 8 chars, uppercase, lowercase, digit, special
^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,}$JSON Web Token format
^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$US phone number formats
^\+?1?[-. ]?\(?\d{3}\)?[-. ]?\d{3}[-. ]?\d{4}$International phone with country code
^\+(?:[0-9] ?){6,14}[0-9]$Visa, Mastercard, Amex, Discover
^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|3[47][0-9]{13}|6(?:011|5[0-9]{2})[0-9]{12})$Letters only (no spaces)
^[a-zA-Z]+$Letters and numbers only
^[a-zA-Z0-9]+$3-16 chars: letters, numbers, underscore, hyphen
^[a-zA-Z0-9_-]{3,16}$Matches any whitespace character
\sExtracts file extension
\.([a-zA-Z0-9]+)$Common image file extensions
\.(jpe?g|png|gif|webp|svg|bmp|ico)$