regexLibrary.title

regexLibrary.subtitle

Test Your Regex

Try patterns with our interactive regex tester

23 patterns

Email Address

i

Email & Contact

Validates standard email addresses

^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$
βœ“ user@example.com
βœ“ john.doe@company.co.uk

US Phone Number

Email & Contact

Matches US phone numbers in various formats

^(\+1)?[\s.-]?\(?([0-9]{3})\)?[\s.-]?([0-9]{3})[\s.-]?([0-9]{4})$
βœ“ (555) 123-4567
βœ“ +1-555-123-4567

International Phone

Email & Contact

E.164 format international phone numbers

^\+?[1-9]\d{1,14}$
βœ“ +14155552671
βœ“ +442071234567

URL (HTTP/HTTPS)

URLs & Web

Validates HTTP and HTTPS URLs

^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)$
βœ“ https://example.com
βœ“ http://www.site.com/path

Domain Name

i

URLs & Web

Validates domain names

^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z0-9][a-z0-9-]{0,61}[a-z0-9]$
βœ“ example.com
βœ“ sub.domain.co.uk

IPv4 Address

URLs & Web

Matches valid IPv4 addresses

^(?:(?: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
βœ“ 10.0.0.255

URL Slug

URLs & Web

Validates URL-friendly slugs

^[a-z0-9]+(?:-[a-z0-9]+)*$
βœ“ my-blog-post
βœ“ product-name-123

Strong Password

Passwords & Security

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

^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,}$
βœ“ MyP@ssw0rd
βœ“ Secure123!

JWT Token

Passwords & Security

Matches JSON Web Tokens

^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$
βœ“ eyJhbGc.eyJzdWI.SflKxw

Integer

Numbers & Currency

Matches positive or negative integers

^-?\d+$
βœ“ 123
βœ“ -456
βœ“ 0

Decimal Number

Numbers & Currency

Matches integers and decimal numbers

^-?\d+(\.\d+)?$
βœ“ 123.45
βœ“ -67.89

US Dollar Amount

Numbers & Currency

Matches US dollar amounts

^\$?\d{1,3}(,\d{3})*(\.\d{2})?$
βœ“ $1,234.56
βœ“ 999.99

Credit Card Number

Numbers & Currency

Validates major credit card formats

^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|3[47][0-9]{13})$
βœ“ 4532015112830366

ISO Date (YYYY-MM-DD)

Dates & Time

Matches ISO 8601 date format

^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$
βœ“ 2024-01-15
βœ“ 2023-12-31

24-Hour Time

Dates & Time

Matches 24-hour time format

^([01]\d|2[0-3]):([0-5]\d)$
βœ“ 14:30
βœ“ 23:59

Filename

File & Path

Matches filenames with extensions

^[\w,\s-]+\.[A-Za-z]{2,4}$
βœ“ document.pdf
βœ“ image.jpg

Image File

i

File & Path

Matches common image file extensions

^.+\.(jpg|jpeg|png|gif|bmp|svg|webp)$
βœ“ photo.jpg
βœ“ icon.png

Hex Color

HTML & Code

Matches hex color codes

^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$
βœ“ #FF5733
βœ“ #f00

Variable Name

HTML & Code

Matches valid JavaScript variable names

^[a-zA-Z_$][a-zA-Z0-9_$]*$
βœ“ myVariable
βœ“ _private

Username

Text & Content

Alphanumeric username, 3-16 characters

^[a-zA-Z0-9_-]{3,16}$
βœ“ john_doe
βœ“ user123

Hashtag

Text & Content

Matches social media hashtags

^#[a-zA-Z0-9_]+$
βœ“ #coding
βœ“ #WebDev

UUID

i

Text & Content

Matches UUID v4 format

^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$
βœ“ 550e8400-e29b-41d4-a716-446655440000

US ZIP Code

Geographic

Matches US ZIP codes

^\d{5}(-\d{4})?$
βœ“ 12345
βœ“ 12345-6789

About Regex Library

Regular expressions (regex) are powerful patterns used for matching, searching, and manipulating text. This library provides ready-to-use regex patterns for common validation and extraction tasks.

How to Use

  • Browse patterns by category or search by name
  • Click copy button to copy pattern to clipboard
  • Test patterns using our Regex Tester tool
  • Flags like 'i' indicate case-insensitive matching