Browse All Patterns

Explore our complete collection of community-validated regex patterns.

Validation

Simple Email

Matches standard email addresses (Note: strictly 99.9% compliant)

/^[^\s@]+@[^\s@]+\.[^\s@]+$/
#email#form#contact
Test It
Validation

ISO Date

Matches dates in YYYY-MM-DD format

/^\d{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[12]\d|3[01])$/
#date#time#iso
Test It
Validation

24-Hour Time

Matches time in HH:MM format (24-hour)

/^(?:[01]\d|2[0-3]):[0-5]\d$/
#time#clock
Test It
Validation

URL

Matches standard URLs (http/https)

/^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$/
#web#link
Test It
Validation

Username

Alphanumeric, underscores, hyphens, 3-16 characters

/^[a-zA-Z0-9_-]{3,16}$/
#auth#user
Test It
Validation

URL Slug

Matches URL-friendly slugs (lowercase, hyphens)

/^[a-z0-9]+(?:-[a-z0-9]+)*$/
#web#url#seo
Test It
Validation

Credit Card (Basic)

Matches 16-digit credit card numbers (simple format)

/^\d{4}[- ]?\d{4}[- ]?\d{4}[- ]?\d{4}$/
#payment#finance#cc
Test It
Social

Twitter Handle

Matches a Twitter handle (username) without the @ symbol

/^[a-zA-Z0-9_]{1,15}$/
#social#twitter#username
Test It
Social

YouTube URL

Matches standard YouTube video URLs

/^(https?:\/\/)?(www\.)?(youtube\.com|youtu\.be)\/.+$/
#social#video#url
Test It
Social

Instagram Username

Matches Instagram usernames (up to 30 chars, letters, numbers, periods, underscores)

/^[a-zA-Z0-9._]{1,30}$/
#social#instagram#username
Test It
Social

LinkedIn Profile URL

Matches standard LinkedIn public profile URLs

/^https:\/\/(www\.)?linkedin\.com\/in\/[a-zA-Z0-9-]{5,30}\/?$/
#social#linkedin#url+1
Test It
Social

Discord Username

Matches new Discord usernames (lowercase, alphanumeric, dot, underscore)

/^[a-z0-9_.]{2,32}$/
#social#discord#username+1
Test It
Social

Hashtag

Matches a standard hashtag (starting with #)

/^#[a-zA-Z0-9_]+$/
#social#tag#metadata
Test It
Social

Telegram Username

Matches Telegram usernames (5-32 chars, alphanumeric, underscore)

/^[a-zA-Z0-9_]{5,32}$/
#social#telegram#username+1
Test It
Social

Slack Channel

Matches Slack channel names (lowercase, hyphens, up to 80 chars)

/^#[a-z0-9-_]{1,80}$/
#social#slack#channel+1
Test It
Security

Strong Password

At least 8 chars, 1 uppercase, 1 lowercase, 1 number, 1 special char

/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,}$/
#security#auth#password
Test It
Security

IPv4 Address

Matches a valid IPv4 address

/^(?:(?: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]?)$/
#security#network#ip
Test It
Security

IPv6 Address

Matches standard IPv6 addresses

/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/
#security#network#ip+1
Test It
Security

MAC Address

Matches standard MAC addresses (colon or hyphen separated)

/^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$/
#security#network#hardware
Test It
Security

UUID / GUID

Matches standard UUIDs (Version 1-5)

/^[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}$/
#security#id#database
Test It
Security

JSON Web Token (JWT)

Matches the structure of a JWT (Header.Payload.Signature)

/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/
#security#auth#token
Test It
Security

SHA-256 Hash

Matches a SHA-256 hash (64 hex characters)

/^[a-fA-F0-9]{64}$/
#security#hash#crypto
Test It
Security

BCrypt Hash

Matches BCrypt password hashes

/^\$2[ayb]\$[0-9]{2}\$[A-Za-z0-9\.\/]{53}$/
#security#hash#password
Test It
Development

Git Commit Hash

Matches a full 40-character SHA-1 git commit hash

/^[0-9a-f]{40}$/
#dev#git#version-control
Test It
Development

Hex Color Code

Matches 3 or 6 digit hex color codes with optional #

/^#?([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$/
#dev#css#design
Test It
Development

Semantic Versioning (SemVer)

Matches standard SemVer strings (X.Y.Z)

/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/
#dev#version#release
Test It
Development

Cron Expression

Matches standard 5-part cron expressions

/^(\*|([0-9]|1[0-9]|2[0-9]|3[0-9]|4[0-9]|5[0-9])|\*\/([0-9]|1[0-9]|2[0-9]|3[0-9]|4[0-9]|5[0-9])) (\*|([0-9]|1[0-9]|2[0-3])|\*\/([0-9]|1[0-9]|2[0-3])) (\*|([1-9]|1[0-9]|2[0-9]|3[0-1])|\*\/([1-9]|1[0-9]|2[0-9]|3[0-1])) (\*|([1-9]|1[0-2])|\*\/([1-9]|1[0-2])) (\*|([0-6])|\*\/([0-6]))$/
#dev#ops#scheduler
Test It
Development

AWS Access Key ID

Matches AWS Access Key IDs (starts with AKIA, 20 chars)

/^AKIA[0-9A-Z]{16}$/
#dev#aws#cloud+1
Test It
Development

Markdown Link

Matches standard Markdown links [text](url)

/^\[([^\]]+)\]\(([^)]+)\)$/
#dev#markdown#documentation
Test It
Development

NPM Package Name

Matches valid NPM package names (including scoped)

/^(?:@[a-z0-9-*~][a-z0-9-*._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/
#dev#npm#javascript
Test It
Country SpecificIndia

Indian PAN Card

Matches Permanent Account Number (PAN) format used in India

/^[A-Z]{5}[0-9]{4}[A-Z]{1}$/
#india#id#finance+1
Test It
Country SpecificIndia

Indian Aadhaar Number

Matches 12-digit Unique Identification Number (UIDAI)

/^[2-9]\d{11}$/
#india#id#uidai
Test It
Country SpecificIndia

Indian GSTIN

Matches Goods and Services Tax Identification Number

/^[0-9]{2}[A-Z]{5}[0-9]{4}[A-Z]{1}[1-9A-Z]{1}Z[0-9A-Z]{1}$/
#india#tax#business
Test It
Country SpecificIndia

Indian IFSC Code

Matches Indian Financial System Code for bank branches

/^[A-Z]{4}0[A-Z0-9]{6}$/
#india#banking#finance
Test It
Country SpecificIndia

Indian Pincode

Matches 6-digit Indian Postal Code

/^[1-9][0-9]{5}$/
#india#address#postal
Test It
Country SpecificIndia

Indian Mobile Number

Matches Indian mobile numbers starting with 6-9, optional +91

/^(\+91[\-\s]?)?[6-9]\d{9}$/
#india#phone#contact
Test It
Country SpecificIndia

Indian Vehicle Registration

Matches standard Indian vehicle registration numbers

/^[A-Z]{2}[0-9]{1,2}(?:[A-Z])?(?:[A-Z]*)?[0-9]{4}$/
#india#transport#vehicle
Test It
Country SpecificUSA

US Social Security Number

Matches US Social Security Numbers (SSN) in format XXX-XX-XXXX

/^(?!000|666|9\d{2})\d{3}-(?!00)\d{2}-(?!0000)\d{4}$/
#usa#ssn#id+1
Test It
Country SpecificUSA

US Zip Code

Matches 5 digit zip codes with optional +4 extension

/^\d{5}(-\d{4})?$/
#usa#address#zip-code
Test It
Country SpecificUSA

US Phone Number

Matches standard US phone numbers with various formats

/^\(?([2-9][0-8][0-9])\)?[-. ]?([2-9][0-9]{2})[-. ]?([0-9]{4})$/
#usa#phone#contact
Test It
Country SpecificUSA

US Passport Number

Matches US Passport numbers (9 digits)

/^\d{9}$/
#usa#passport#id+1
Test It
Country SpecificUSA

Employer Identification Number (EIN)

Matches US Employer Identification Numbers (XX-XXXXXXX)

/^[1-9]\d?-\d{7}$/
#usa#tax#business+1
Test It
Country SpecificUSA

US State Abbreviation

Matches standard 2-letter US state abbreviations

/^(A[KLRZ]|C[AOT]|D[CE]|FL|GA|HI|I[ADLN]|K[SY]|LA|M[ADEINOST]|N[CDEHJMVY]|O[HKR]|PA|RI|S[CD]|T[NX]|UT|V[AT]|W[AIVY])$/
#usa#address#state
Test It
Country SpecificUSA

US Currency

Matches US Dollar amounts with optional cents and commas

/^\$?\d{1,3}(,\d{3})*(\.\d{2})?$/
#usa#currency#money+1
Test It