Essential Regular Expression Patterns Dataset

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 AddressContact^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$user@example.comStandard 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.comRFC 5322 compliant email
Phone (International)Contact^\+?[1-9]\d{1,14}$+14155551234E.164 international phone format
Phone (US)Contact^\(?([0-9]{3})\)?[-. ]?([0-9]{3})[-. ]?([0-9]{4})$(415) 555-1234US phone number formats
Phone (Thai)Contact^(0[689]{1})\d{8}$0812345678Thai 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/pathHTTP/HTTPS URL validation
URL (Simple)Web^(https?:\/\/)?[\w.-]+\.[a-z]{2,}(\/\S*)?$example.com/pageSimple URL pattern
Domain NameWeb^(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$sub.example.comDomain 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.1IPv4 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:7334IPv6 address (full form)
MAC AddressWeb^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$00:1A:2B:3C:4D:5EMAC address validation
Slug (URL-friendly)Web^[a-z0-9]+(?:-[a-z0-9]+)*$my-blog-post-titleURL slug format
Password (Strong)Security^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,}$Pass@123Min 8 chars, upper, lower, digit, special
Password (Medium)Security^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[A-Za-z\d]{8,}$Password1Min 8 chars, upper, lower, digit
UUID v4Security^[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-446655440000UUID version 4 format
JWT TokenSecurity^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$eyJhbGc.eyJzdWI.SflKxwJSON Web Token format
Hex ColorSecurity^#?([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$#FF5733Hex color code
IntegerNumber^-?\d+$-12345Positive or negative integer
Decimal NumberNumber^-?\d*\.?\d+$123.45Decimal number
Currency (USD)Finance^\$?\d{1,3}(,\d{3})*(\.\d{2})?$$1,234.56US currency format
Credit CardFinance^(?: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})$4111111111111111Visa, MC, Amex, Discover
CVVFinance^[0-9]{3,4}$123Credit card CVV/CVC
IBANFinance^[A-Z]{2}[0-9]{2}[A-Z0-9]{4}[0-9]{7}([A-Z0-9]?){0,16}$DE89370400440532013000International 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-25ISO 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/2024European date format
Date (MM/DD/YYYY)DateTime^(0[1-9]|1[0-2])\/(0[1-9]|[12]\d|3[01])\/\d{4}$12/25/2024US date format
Time (24h)DateTime^([01]\d|2[0-3]):([0-5]\d)$23:5924-hour time format
Time (12h)DateTime^(0?[1-9]|1[0-2]):[0-5][0-9]\s?(AM|PM|am|pm)$11:30 PM12-hour time with AM/PM
ISO 8601 DateTimeDateTime^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[+-]\d{2}:\d{2})?$2024-12-25T10:30:00ZISO 8601 datetime
UsernameText^[a-zA-Z0-9_]{3,16}$user_name123Alphanumeric with underscore, 3-16 chars
AlphanumericText^[a-zA-Z0-9]+$abc123Letters and numbers only
Letters OnlyText^[a-zA-Z]+$HelloWorldEnglish letters only
No Special CharsText^[a-zA-Z0-9\s]+$Hello World 123Alphanumeric with spaces
Whitespace TrimText^\S.*\S$|^\S$no leading/trailing spacesNo leading/trailing whitespace
US SSNID^(?!000|666|9\d{2})\d{3}-(?!00)\d{2}-(?!0000)\d{4}$123-45-6789US Social Security Number
US ZIP CodeID^\d{5}(-\d{4})?$12345-6789US ZIP code (5 or 9 digit)
UK PostcodeID^[A-Z]{1,2}[0-9][A-Z0-9]?\s?[0-9][A-Z]{2}$SW1A 1AAUK postal code
ISBN-10ID^(?:\d{9}X|\d{10})$0306406152ISBN-10 format
ISBN-13ID^97[89]\d{10}$9780306406157ISBN-13 format
File ExtensionFile^.*\.(jpg|jpeg|png|gif|pdf|doc|docx)$document.pdfCommon file extensions
File Path (Unix)File^\/([\w.-]+\/)*[\w.-]+$/home/user/file.txtUnix file path
File Path (Windows)File^[a-zA-Z]:\\(?:[\w.-]+\\)*[\w.-]+$C:\Users\file.txtWindows file path
HTML TagCode<([a-z]+)([^<]+)*(?:>(.*)<\/\1>|\s+\/>)<div class="x">content</div>HTML tag matching
HashtagSocial^#[a-zA-Z0-9_]+$#trendingSocial media hashtag
Twitter HandleSocial^@[a-zA-Z0-9_]{1,15}$@usernameTwitter/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.