Code Utilities

Regex Pattern Generator

Generate regex patterns from natural language, browse common patterns, and test them against sample text — no sign-up required.

Natural Language
Pattern Library
EmailWeb
/[a-zA-Z0-9._%+\-]+@[a-zA-Z0-9.\-]+\.[a-zA-Z]{2,}/g

Matches standard email addresses

URLWeb
/https?:\/\/[\w\-]+(\.[\w\-]+)+(\/[\w\-./?%&=@#]*)?/gi

Matches HTTP/HTTPS URLs

Phone (US)Identity
/(\+1[\s.-]?)?(\(?\d{3}\)?[\s.-]?)\d{3}[\s.-]?\d{4}/g

Matches US phone numbers in various formats

IPv4Network
/\b(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\b/g

Matches valid IPv4 addresses (0.0.0.0-255.255.255.255)

Date (YYYY-MM-DD)DateTime
/\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])/g

Matches ISO 8601 date format

Time (HH:MM)DateTime
/([01]\d|2[0-3]):[0-5]\d(:[0-5]\d)?/g

Matches 24-hour time with optional seconds

Hex ColorWeb
/#([0-9a-fA-F]{3}){1,2}\b/gi

Matches 3 or 6 digit hex color codes

Credit CardIdentity
/\b(?:4\d{3}|5[1-5]\d{2}|3[47]\d{2}|6(?:011|5\d{2}))[\s-]?\d{4}[\s-]?\d{4}[\s-]?\d{3,4}\b/g

Matches Visa, MC, Amex, Discover card numbers

SSNIdentity
/\b\d{3}-\d{2}-\d{4}\b/g

Matches US Social Security Numbers (XXX-XX-XXXX)

Zip Code (US)Identity
/\b\d{5}(-\d{4})?\b/g

Matches 5 or 9 digit US zip codes

Flags /g/
Test Pattern
Test Text
Enter a pattern and test text to begin matching