Essential Regular Expression Patterns Dataset
This dataset provides 45 widely used regular expression patterns covering various categories like contact information, data formats, and validation rules. Each entry includes the pattern, category, an example, and a description.
Free Download
Key Takeaways
- Access 45 pre-compiled regular expression patterns for immediate use.
- Explore common regex for email, phone numbers, URLs, and more.
- Download patterns for various programming and data validation tasks.
- Use ready-to-implement regex to streamline your development and analysis workflows.
Showing 45 of 45
| Pattern Name | Category | Regex Pattern | Example | Description |
|---|---|---|---|---|
| Email Address | Contact | ^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$ | user@example.com | Standard email validation |
| Email (Strict) | Contact | ^[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])?)*$ | name+tag@sub.domain.com | RFC 5322 compliant email |
| Phone (International) | Contact | ^\+?[1-9]\d{1,14}$ | +14155551234 | E.164 international phone format |
| Phone (US) | Contact | ^\(?([0-9]{3})\)?[-. ]?([0-9]{3})[-. ]?([0-9]{4})$ | (415) 555-1234 | US phone number formats |
| Phone (Thai) | Contact | ^(0[689]{1})\d{8}$ | 0812345678 | Thai mobile phone number |
| URL (HTTP/HTTPS) | Web | ^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)$ | https://example.com/path | HTTP/HTTPS URL validation |
| URL (Simple) | Web | ^(https?:\/\/)?[\w.-]+\.[a-z]{2,}(\/\S*)?$ | example.com/page | Simple URL pattern |
| Domain Name | Web | ^(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$ | sub.example.com | Domain name validation |
| IP Address (IPv4) | Web | ^(?:(?: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]?)$ | 192.168.1.1 | IPv4 address validation |
| IP Address (IPv6) | Web | ^([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$ | 2001:0db8:85a3:0000:0000:8a2e:0370:7334 | IPv6 address (full form) |
| MAC Address | Web | ^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$ | 00:1A:2B:3C:4D:5E | MAC address validation |
| Slug (URL-friendly) | Web | ^[a-z0-9]+(?:-[a-z0-9]+)*$ | my-blog-post-title | URL slug format |
| Password (Strong) | Security | ^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,}$ | Pass@123 | Min 8 chars, upper, lower, digit, special |
| Password (Medium) | Security | ^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[A-Za-z\d]{8,}$ | Password1 | Min 8 chars, upper, lower, digit |
| UUID v4 | Security | ^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$ | 550e8400-e29b-41d4-a716-446655440000 | UUID version 4 format |
| JWT Token | Security | ^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$ | eyJhbGc.eyJzdWI.SflKxw | JSON Web Token format |
| Hex Color | Security | ^#?([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$ | #FF5733 | Hex color code |
| Integer | Number | ^-?\d+$ | -12345 | Positive or negative integer |
| Decimal Number | Number | ^-?\d*\.?\d+$ | 123.45 | Decimal number |
| Currency (USD) | Finance | ^\$?\d{1,3}(,\d{3})*(\.\d{2})?$ | $1,234.56 | US currency format |
| Credit Card | Finance | ^(?: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})$ | 4111111111111111 | Visa, MC, Amex, Discover |
| CVV | Finance | ^[0-9]{3,4}$ | 123 | Credit card CVV/CVC |
| IBAN | Finance | ^[A-Z]{2}[0-9]{2}[A-Z0-9]{4}[0-9]{7}([A-Z0-9]?){0,16}$ | DE89370400440532013000 | International Bank Account Number |
| Date (YYYY-MM-DD) | DateTime | ^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$ | 2024-12-25 | ISO 8601 date format |
| Date (DD/MM/YYYY) | DateTime | ^(0[1-9]|[12]\d|3[01])\/(0[1-9]|1[0-2])\/\d{4}$ | 25/12/2024 | European date format |
| Date (MM/DD/YYYY) | DateTime | ^(0[1-9]|1[0-2])\/(0[1-9]|[12]\d|3[01])\/\d{4}$ | 12/25/2024 | US date format |
| Time (24h) | DateTime | ^([01]\d|2[0-3]):([0-5]\d)$ | 23:59 | 24-hour time format |
| Time (12h) | DateTime | ^(0?[1-9]|1[0-2]):[0-5][0-9]\s?(AM|PM|am|pm)$ | 11:30 PM | 12-hour time with AM/PM |
| ISO 8601 DateTime | DateTime | ^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[+-]\d{2}:\d{2})?$ | 2024-12-25T10:30:00Z | ISO 8601 datetime |
| Username | Text | ^[a-zA-Z0-9_]{3,16}$ | user_name123 | Alphanumeric with underscore, 3-16 chars |
| Alphanumeric | Text | ^[a-zA-Z0-9]+$ | abc123 | Letters and numbers only |
| Letters Only | Text | ^[a-zA-Z]+$ | HelloWorld | English letters only |
| No Special Chars | Text | ^[a-zA-Z0-9\s]+$ | Hello World 123 | Alphanumeric with spaces |
| Whitespace Trim | Text | ^\S.*\S$|^\S$ | no leading/trailing spaces | No leading/trailing whitespace |
| US SSN | ID | ^(?!000|666|9\d{2})\d{3}-(?!00)\d{2}-(?!0000)\d{4}$ | 123-45-6789 | US Social Security Number |
| US ZIP Code | ID | ^\d{5}(-\d{4})?$ | 12345-6789 | US ZIP code (5 or 9 digit) |
| UK Postcode | ID | ^[A-Z]{1,2}[0-9][A-Z0-9]?\s?[0-9][A-Z]{2}$ | SW1A 1AA | UK postal code |
| ISBN-10 | ID | ^(?:\d{9}X|\d{10})$ | 0306406152 | ISBN-10 format |
| ISBN-13 | ID | ^97[89]\d{10}$ | 9780306406157 | ISBN-13 format |
| File Extension | File | ^.*\.(jpg|jpeg|png|gif|pdf|doc|docx)$ | document.pdf | Common file extensions |
| File Path (Unix) | File | ^\/([\w.-]+\/)*[\w.-]+$ | /home/user/file.txt | Unix file path |
| File Path (Windows) | File | ^[a-zA-Z]:\\(?:[\w.-]+\\)*[\w.-]+$ | C:\Users\file.txt | Windows file path |
| HTML Tag | Code | <([a-z]+)([^<]+)*(?:>(.*)<\/\1>|\s+\/>) | <div class="x">content</div> | HTML tag matching |
| Hashtag | Social | ^#[a-zA-Z0-9_]+$ | #trending | Social media hashtag |
| Twitter Handle | Social | ^@[a-zA-Z0-9_]{1,15}$ | @username | Twitter/X username |
Use Cases
- Import the CSV file into your SQL database or Python scripts to implement data validation logic for user inputs or data cleaning.
- Use the Excel file to filter, sort, and analyze common regex patterns, or for quick lookup and reporting by data analysts.
- Print the PDF version for classroom reference, offline study, or as a handy cheatsheet for developers and students.
- Integrate these patterns into web forms, APIs, or data processing pipelines to ensure data integrity and format compliance.