Regex Pattern Library
Common Regex Patterns
A collection of tested and commonly used regular expressions. Click any pattern to copy it.
Email Validation
^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$
Matches most common email formats
^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:...)*$
Stricter validation following RFC 5322 standard
URL & Links
https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}...
Matches HTTP and HTTPS URLs
^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$
Matches URLs with optional http/https prefix
^[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9](?:\.[a-zA-Z]{2,})+$
Validates domain names without protocol
Phone Numbers
^\+?[1-9]\d{1,14}$
International phone format (E.164 standard)
^\(?([0-9]{3})\)?[-. ]?([0-9]{3})[-. ]?([0-9]{4})$
US format: (123) 456-7890 or 123-456-7890
^(\+44\s?7\d{3}|\(?07\d{3}\)?)\s?\d{3}\s?\d{3}$
UK mobile format with optional +44
IP Addresses
^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}...
Valid IPv4 address (0.0.0.0 to 255.255.255.255)
^([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$
Full IPv6 address format
Dates & Times
^\d{4}-\d{2}-\d{2}$
ISO 8601 date format
^(0[1-9]|1[0-2])\/(0[1-9]|[12][0-9]|3[01])\/\d{4}$
US date format with validation
^([01]?[0-9]|2[0-3]):[0-5][0-9](:[0-5][0-9])?$
24-hour time format (HH:MM or HH:MM:SS)
Password Validation
^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[a-zA-Z\d]{8,}$
Min 8 chars, 1 uppercase, 1 lowercase, 1 number
^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])...
Min 8 chars with special character required
Financial
^4[0-9]{12}(?:[0-9]{3})?$
Visa card numbers (13 or 16 digits)
^5[1-5][0-9]{14}$
Mastercard numbers (16 digits)
^\d{5}(-\d{4})?$
US ZIP code (5 digits or ZIP+4)
Usernames & IDs
^[a-zA-Z0-9_]{3,16}$
Alphanumeric + underscore, 3-16 chars
^[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$
Standard UUID version 4 format
^#?([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$
Hex color (#fff or #ffffff)
How to Use This Tool
- Search or Browse: Use the search field to find patterns by keyword (email, phone, date), or scroll through categories. Patterns are grouped by common use cases for easy navigation.
- Review Pattern Details: Each entry shows the full regex pattern, a description of what it matches, and example matches. Verify the pattern fits your specific requirements.
- Copy the Pattern: Click the "Copy" button next to any pattern to copy it to your clipboard. Patterns are ready to use in your code without modification.
- Adapt as Needed: Patterns may need minor adjustments for your use case—removing anchors for embedded matching, adding flags for case-insensitivity, or modifying quantifiers for stricter/looser matching.
Technical Details
This library contains battle-tested regular expressions for common validation and extraction tasks. Each pattern is designed for JavaScript regex syntax, compatible with most modern programming languages. Patterns are tested against both valid matches and invalid inputs to ensure reliability.
Patterns range from simple (basic email format) to complex (RFC-compliant variants). When multiple patterns exist for a use case, simpler versions are preferred for performance—complex patterns can significantly slow matching on large texts. All patterns include ^ and $ anchors for full-string validation; remove them if searching within larger strings. Character classes use ASCII ranges by default; add the u flag for proper Unicode support when validating international text.
Common Mistakes to Avoid
- Using Complex Patterns When Simple Suffice: RFC-compliant email regex is 1000+ characters. For most applications, the basic email pattern works fine. Start simple; upgrade only if you hit real-world false negatives.
- Forgetting Context-Specific Escaping: When embedding regex in strings, backslashes may need double-escaping. JavaScript string "\\d" becomes \d in the regex. Some languages (Python raw strings, JavaScript regex literals) don't need this.
- Ignoring Unicode: Patterns like [a-z] only match ASCII letters, failing on é, ü, or non-Latin scripts. For international text, use Unicode-aware patterns or the u flag. \p{L} matches any Unicode letter (in languages supporting Unicode property escapes).
Related Tools
Need to generate a custom pattern not in the library? Use our Regex Generator to build one. To understand what a pattern does, paste it into the Regex Explainer.
Frequently Asked Questions
Are these patterns guaranteed to match all valid inputs?
Patterns cover the most common valid formats for each use case. Edge cases exist that simpler patterns miss—unusual but valid emails, international phone formats, etc. Test patterns against your specific requirements and adjust as needed.
Can I use these patterns in any programming language?
Patterns use JavaScript/PCRE syntax, compatible with most languages (Python, Java, C#, PHP, Ruby, Go). Some features like lookahead/lookbehind may vary—check your language's regex documentation for specific syntax differences.
How do I modify a pattern to be case-insensitive?
Add the i flag when using the pattern. In JavaScript, use /pattern/i or new RegExp(pattern, 'i'). In Python, use re.IGNORECASE. This makes [a-z] match [a-zA-Z] and all character classes ignore case.