Test regular expressions with live match highlighting, group capture, and a library of common patterns like email, URL, phone and more.
Email address
Matches standard email addresses
/[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/g
Full name (two words)
Matches a capitalized first and last name
/[A-Z][a-z]+\s[A-Z][a-z]+/g
Website / URL
Matches http/https URLs with optional path and query string
/https?:\/\/[\w.-]+\.[a-zA-Z]{2,}(?:\/[^\s]*)?/g
Phone number (US)
Matches common US phone number formats
/\(?\d{3}\)?[-.\s]?\d{3}[-.\s]?\d{4}/g
Hex color
Matches 3 or 6 digit hex color codes
/#(?:[0-9a-fA-F]{3}){1,2}\b/g
IPv4 address
Matches IPv4 addresses (does not validate octet range)
/\b(?:\d{1,3}\.){3}\d{1,3}\b/g
Date (YYYY-MM-DD)
Matches ISO 8601 dates
/\d{4}-\d{2}-\d{2}/g
Time (HH:MM 24h)
Matches 24-hour HH:MM time strings
/([01]\d|2[0-3]):[0-5]\d/g
Hashtag
Matches hashtags made of letters, digits and underscores
/#[A-Za-z0-9_]+/g
HTML tag
Matches opening and closing HTML tags
/<\/?[a-zA-Z][^>]*>/g
Slug (kebab-case)
Matches lowercase, hyphen-separated slugs
/^[a-z0-9]+(?:-[a-z0-9]+)*$/
Strong password
Requires 8+ chars with lower, upper, digit and symbol
/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[^\w\s]).{8,}$/
Whitespace runs
Matches two or more consecutive whitespace characters
/\s{2,}/g
Click a pattern to load it into the workbench below, or click the copy icon to copy just the regex.