Common Regex Library
A curated collection of the most useful regular expression patterns for everyday development. Search, test, and copy snippets for your projects.
Email Address (RFC 5322)
ValidationMatches a valid email address according to RFC 5322 standard. Covers 99.9% of use cases.
^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$Complex Password
ValidationEnforces a strong password: Minimum 8 characters, at least one uppercase letter, one lowercase letter, one number and one special character.
^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,}$Username
ValidationAlphanumeric string that may include _ and - having a length of 3 to 16 characters.
^[a-zA-Z0-9_-]{3,16}$URL (Web Address)
WebMatches standard URLs (HTTP/HTTPS), with or without www.
https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)IPv4 Address
WebMatches a valid IPv4 address (0.0.0.0 to 255.255.255.255).
^(?:(?: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 Code
WebMatches hex color codes with or without # prefix, supporting both 3 and 6 digit formats.
^#?([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$URL Slug
WebMatches URL-friendly slugs (lowercase alphanumeric with hyphens).
^[a-z0-9]+(?:-[a-z0-9]+)*$Date (YYYY-MM-DD)
DataMatches dates in ISO 8601 format (YYYY-MM-DD). Does not validate leap years or days in month.
^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$Time (24 Hour)
DataMatches time in 24-hour format (HH:MM).
^([01]\d|2[0-3]):([0-5]\d)$UUID / GUID
DataMatches a standard UUID (Universally Unique Identifier).
^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$US Phone Number
ContactMatches US phone numbers in various formats: (555) 555-5555, 555-555-5555, 555.555.5555.
^\(?([2-9][0-9]{2})\)?[-. ]?([2-9][0-9]{2})[-. ]?([0-9]{4})$HTML Tag
CodeMatches simple HTML tags and their content.
<([a-z]+)([^<]+)*(?:>(.*)<\/\1>|\s+\/>)Why use these patterns?
✅ Validated
All patterns are tested against common use cases to ensure accuracy and reliability.
⚡️ Optimized
Crafted for performance to avoid catastrophic backtracking and ensure fast matching.
🛡️ Secure
Includes security-focused patterns like strict password validation and input sanitization.
Popular Patterns
Email Address
Validate standard email formats. Includes support for common domains and subdomains.
Try Email Regex →Dates (YYYY-MM-DD)
Match dates in ISO 8601 format. Validates year, month, and day structure.
Try Date Regex →US Phone Number
Match various US phone formats including dashes, dots, and parentheses.
Try Phone Regex →