Skip to main content
DevTools24

Regex Library

Searchable library of common regex patterns. Test patterns with your own text to verify matches.

Email Addressemail
Validates standard email addresses
/^[\w.-]+@[\w.-]+\.[a-zA-Z]{2,}$/i
URL (HTTP/HTTPS)url
Validates HTTP and HTTPS URLs
/^https?:\/\/[\w.-]+(?:\.[\w.-]+)+[\w\-._~:/?#[\]@!$&'()*+,;=]*$/
Domain Nameurl
Validates domain names
/^(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/
IP Address (IPv4)network
Validates 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]?)$/
IP Address (IPv6)network
Validates IPv6 addresses (full form)
/^(?:[0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$/
MAC Addressnetwork
Validates MAC addresses
/^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$/
US Phone Numberphone
US phone number formats
/^\(?[0-9]{3}\)?[-. ]?[0-9]{3}[-. ]?[0-9]{4}$/
International Phonephone
E.164 international phone format
/^\+?[1-9]\d{1,14}$/
Date (YYYY-MM-DD)datetime
ISO 8601 date format
/^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$/
Date (MM/DD/YYYY)datetime
US date format
/^(0[1-9]|1[0-2])\/(0[1-9]|[12]\d|3[01])\/\d{4}$/
Time (24h)datetime
24-hour time format
/^([01]\d|2[0-3]):([0-5]\d)(?::([0-5]\d))?$/
Time (12h)datetime
12-hour time with AM/PM
/^(0?[1-9]|1[0-2]):[0-5]\d\s?(AM|PM|am|pm)$/i
Strong Passwordsecurity
Min 8 chars, upper, lower, number, special
/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,}$/
UUID v4security
UUID version 4 format
/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i
JWT Tokensecurity
JSON Web Token format
/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/
Integernumbers
Positive or negative integers
/^-?\d+$/
Decimal Numbernumbers
Decimal numbers
/^-?\d*\.?\d+$/
Currency (USD)numbers
US currency format
/^\$?\d{1,3}(?:,\d{3})*(?:\.\d{2})?$/
Percentagenumbers
Percentage values
/^-?\d+(?:\.\d+)?%$/
Hex Colornumbers
Hex color codes
/^#?([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/
Slugtext
URL-friendly slug format
/^[a-z0-9]+(?:-[a-z0-9]+)*$/
Usernametext
Alphanumeric with underscores, 3-20 chars
/^[a-zA-Z0-9_]{3,20}$/
Alphanumerictext
Letters and numbers only
/^[a-zA-Z0-9]+$/
No Whitespacetext
No whitespace characters
/^\S+$/
HTML Tagtext
Match HTML tags with content
/<([a-zA-Z][a-zA-Z0-9]*)\b[^>]*>.*?<\/\1>/s
Semantic Versioncode
SemVer format
/^(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-]+)*))?$/
Variable Name (JS)code
Valid JavaScript variable name
/^[a-zA-Z_$][a-zA-Z0-9_$]*$/
Git Commit Hashcode
Full Git commit SHA
/^[0-9a-f]{40}$/i
File Path (Unix)code
Unix file path
/^(\/[^\/ ]*)+\/?$/

Regular Expression Patterns - Technische Details

Regular expressions are patterns used to match character combinations in strings. This library contains battle-tested patterns for common validation tasks like emails, URLs, phone numbers, and dates.

Kommandozeilen-Alternative

// Email validation\nconst email = /^[\\w.-]+@[\\w.-]+\\.[a-zA-Z]{2,}$/;\n\n// URL validation\nconst url = /^https?:\\/\\/[\\w.-]+\\.[a-z]{2,}/i;

Referenz

Offizielle Spezifikation ansehen