Skip to main content

Regex Pattern Library

42 tested regex patterns with one-click copy.

Free & unlimited
Search
Category
Basic email
Matches most common email formats.
/[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/g
Email
Strict email (RFC)
Stricter RFC 5322 email validation.
/^[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/
Email
Disposable email domains
Detect common disposable email providers.
/@(mailinator|guerrillamail|tempmail|throwaway|yopmail)\./gi
Email
US phone
US phone numbers in various formats.
/(?:\+?1[-\s.]?)?\(?[2-9]\d{2}\)?[-\s.]?\d{3}[-\s.]?\d{4}/g
Phone
UK phone
UK phone numbers.
/(?:\+44|0)\s?[1-9]\d{1,4}\s?\d{3,4}\s?\d{3,4}/g
Phone
E.164 international
International phone in E.164 format.
/\+[1-9]\d{6,14}/g
Phone
Danish phone
Danish 8-digit phone numbers.
/(?:\+45\s?)?\d{2}\s?\d{2}\s?\d{2}\s?\d{2}/g
Phone
HTTP/HTTPS URL
Match HTTP and HTTPS URLs.
/https?://[\w-]+(\.[\w-]+)+(/[\w.,@?^=%&:/~+#-]*)?/gi
URL
URL with optional protocol
URLs with or without http(s)://.
/(?:https?://)?(?:www\.)?[\w-]+(\.[\w-]+)+(/[\w.,@?^=%&:/~+#-]*)?/gi
URL
URL slug
Valid URL slug (lowercase, hyphens).
/^[a-z0-9]+(?:-[a-z0-9]+)*$/
URL
IPv4 address
Valid IPv4 addresses (0.0.0.0 – 255.255.255.255).
/(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.(?:25[0-5]|2[0-4]\d|[01]?\d\d?)/g
IP address
Private IP ranges
Private/internal IP ranges (RFC 1918).
/(?:10\.\d{1,3}\.\d{1,3}\.\d{1,3}|172\.(?:1[6-9]|2\d|3[01])\.\d{1,3}\.\d{1,3}|192\.168\.\d{1,3}\.\d{1,3})/g
IP address
IPv6 address
Full IPv6 addresses.
/(?:[0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}/g
IP address
ISO 8601 date
YYYY-MM-DD format.
/\d{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[12]\d|3[01])/g
Date & time
European date
DD/MM/YYYY format.
/(?:0[1-9]|[12]\d|3[01])/(?:0[1-9]|1[0-2])/\d{4}/g
Date & time
US date
MM-DD-YYYY format.
/(?:0[1-9]|1[0-2])-(?:0[1-9]|[12]\d|3[01])-\d{4}/g
Date & time
24h time
HH:MM or HH:MM:SS in 24-hour format.
/(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d)?/g
Date & time
ISO datetime
Full ISO 8601 datetime with timezone.
/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:?\d{2})?/g
Date & time
Visa card
Visa card numbers (starts with 4).
/4[0-9]{12}(?:[0-9]{3})?/g
Credit card
Mastercard
Mastercard numbers (starts with 51–55).
/5[1-5][0-9]{14}/g
Credit card
American Express
Amex card numbers (starts with 34 or 37).
/3[47][0-9]{13}/g
Credit card
Danish CPR
Danish personal ID (DDMMYY-XXXX).
/(?:0[1-9]|[12]\d|3[01])(?:0[1-9]|1[0-2])\d{2}-?\d{4}/g
ID numbers
US SSN
US Social Security Number.
/(?!000|666|9\d{2})\d{3}-(?!00)\d{2}-(?!0000)\d{4}/g
ID numbers
UK NI number
UK National Insurance number.
/[A-CEGHJ-PR-TW-Z]{2}\d{6}[A-D]/gi
ID numbers
UUID v4
UUID version 4 format.
/[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}/gi
ID numbers
US ZIP code
US 5-digit or ZIP+4 format.
/\d{5}(-\d{4})?/g
Postal code
UK postcode
UK postcode format.
/[A-Z]{1,2}\d[A-Z\d]?\s?\d[A-Z]{2}/gi
Postal code
Danish postal code
Danish 4-digit postal code.
/\b\d{4}\b/g
Postal code
German PLZ
German 5-digit postal code.
/\b\d{5}\b/g
Postal code
Alphanumeric username
Letters and numbers only, 3–20 chars.
/^[a-zA-Z0-9]{3,20}$/
Username
Social handle (@)
Twitter/Instagram-style handle.
/@[a-zA-Z][a-zA-Z0-9_]{1,14}/g
Username
Strong password
Min 8 chars, upper + lower + number + special.
/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[!@#$%^&*]).{8,}$/
Password
HTML tag
Match HTML opening + closing tag pairs.
/<([a-z][a-z0-9]*)\b[^>]*>(.*?)</\1>/gis
HTML & code
HTML attribute
Extract attribute key-value pairs.
/(\w+)=["']([^"']*)["']/g
HTML & code
Hex color code
CSS hex color (#RGB or #RRGGBB).
/#(?:[0-9a-fA-F]{3}){1,2}\b/g
HTML & code
JS import statement
JavaScript import statements.
/import\s+(?:\{[^}]+\}|\w+)\s+from\s+['"][^'"]+['"]/g
HTML & code
Semantic version
Semantic versioning (major.minor.patch).
/\bv?\d+\.\d+\.\d+(?:-[\w.]+)?(?:\+[\w.]+)?\b/g
HTML & code
Excess whitespace
Two or more consecutive whitespace characters.
/\s{2,}/g
Misc
Duplicate words
Repeated consecutive words.
/\b(\w+)\s+\1\b/gi
Misc
Number with commas
Numbers with thousand separators.
/\d{1,3}(,\d{3})*(\.\d+)?/g
Misc
Markdown link
Markdown [text](url) links.
/\[([^\]]+)\]\(([^)]+)\)/g
Misc
JSON key
JSON object keys.
/"(\w+)"\s*:/g
Misc
All processing happens in your browser. No data is sent to any server.

About this tool

  1. 1

    Browse or search

    Browse categories like Email, Phone, URL, IP, or search by name.

  2. 2

    View pattern details

    Each pattern shows the regex, a plain-English description, and match/non-match examples.

  3. 3

    Copy or test

    Click to copy the regex, or click "Test it" to open the inline tester.

  • Use the flag selector (g, i, m) to customize how the regex behaves.
  • The inline tester lets you paste your own text and see matches highlighted in real-time.
  • Search works across both pattern names and descriptions.
  • 100+ pre-built regex patterns
  • Categories: Email, Phone, URL, IP, Date, Credit Card, and more
  • Inline regex tester
  • Match and non-match examples
  • One-click copy
  • Finding the right regex for form validation
  • Learning regex through curated examples
  • Quickly testing patterns against sample data

Related tools

View all

We use anonymous analytics to improve ToolChamp. No personal data is stored or sold. Privacy Policy