Regex Library

Browse our comprehensive collection of battle-tested regular expressions

📧
Validation

Email Address (Standard)

Validates most common email address formats

^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$
[email protected] [email protected] ✗ invalid@
🔗
Web

URL (HTTP/HTTPS)

Matches HTTP and HTTPS URLs with query strings and fragments

https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)
✓ https://example.com/path?q=1 ✓ http://sub.domain.org ✗ ftp://files.com
📱
Validation US

Phone Number (US)

Validates US phone numbers in various formats

^(\+1)?[-.\s]?\(?\d{3}\)?[-.\s]?\d{3}[-.\s]?\d{4}$
✓ (555) 123-4567 ✓ +1 555.123.4567 ✓ 5551234567
💳
Validation

Credit Card Number

Validates Visa, Mastercard, and American Express

^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|3[47][0-9]{13})$
✓ 4111111111111111 (Visa) ✓ 5500000000000004 (MC) ✓ 340000000000009 (Amex)
🔐
Security

Strong Password

Min 8 chars with uppercase, lowercase, number, and special character

^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,}$
✓ MyP@ssw0rd! ✗ password123 ✗ SHORT1!
📅
Format ISO 8601

Date (YYYY-MM-DD)

ISO 8601 date format with validation

^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$
✓ 2024-01-15 ✓ 2023-12-31 ✗ 2024-13-01
🌐
Format

IPv4 Address

Valid IPv4 address (0-255 for each octet)

^(?:(?: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 ✓ 255.255.255.0 ✗ 256.1.1.1
#️⃣
Format

Hex Color Code

3 or 6 digit hex color with optional hash

^#?([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$
✓ #FF5733 ✓ fff ✗ #GGGGGG
🔑
Format

UUID / GUID

Universally Unique Identifier format

^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$
✓ 550e8400-e29b-41d4-a716-446655440000 ✗ not-a-uuid
👤
Validation

Username

Alphanumeric with underscores, 3-16 characters

^[a-zA-Z0-9_]{3,16}$
✓ john_doe123 ✓ User2024 ✗ ab
🌍
Web

Domain Name

Valid domain name format

^(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$
✓ example.com ✓ sub.domain.co.uk ✗ -invalid.com
📄
Parsing

File Extension

Extract file extensions from filenames

\.([a-zA-Z0-9]+)$
✓ document.pdf → pdf ✓ image.jpeg → jpeg ✗ noextension
📋
Parsing

JSON Key-Value Pair

Extract key-value pairs from JSON files

"([^"]+)"\s*:\s*"([^"]*)"
✓ "name": "John" ✓ "key":"value"
📨
Format

MIME Content-Type

Parse MIME types from email messages

^([a-z]+)\/([a-z0-9.+-]+)(?:;\s*(.+))?$
✓ text/html; charset=utf-8 ✓ application/json
🏷️
Parsing

HTML Tag

Match HTML opening and closing tags

<([a-z][a-z0-9]*)\b[^>]*>(.*?)<\/\1>
✓ <div>content</div> ✓ <span class="x">text</span>
📮
Validation US

ZIP Code (US)

US ZIP code with optional +4 extension

^\d{5}(?:-\d{4})?$
✓ 12345 ✓ 12345-6789 ✗ 1234

Showing 16 of 16 patterns