Common Regex Patterns

Commonly used regular expression patterns for validation and matching

Key Facts

Category
Development
Items
18
Format Families
text, regex

Sample Overview

Commonly used regular expression patterns for validation and matching This sample set belongs to Development and can be used to test related workflows inside Elysia Tools.

📝 ISO Date Format (YYYY-MM-DD)

🟢 simple

Validate ISO 8601 date format

🏷️ regex, regular-expression, pattern, validation, date, iso, format, basic
^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$

📝 24-Hour Time Format

🟢 simple

Validate time in HH:MM format

🏷️ regex, regular-expression, pattern, validation, time, 24h, format, basic
^([01]\d|2[0-3]):[0-5]\d$

📝 Username

🟢 simple

Validate username (alphanumeric, underscore, hyphen)

🏷️ regex, regular-expression, pattern, validation, username, user, account, basic
^[a-zA-Z0-9_-]{3,16}$

📝 US Postal Code (ZIP)

🟢 simple

Validate US ZIP code format

🏷️ regex, regular-expression, pattern, validation, postal, zip, us, basic
^\d{5}(-\d{4})?$

📝 Hexadecimal Color Code

🟢 simple

Match hex color codes (#RGB or #RRGGBB)

🏷️ regex, regular-expression, pattern, validation, color, hex, css, basic
^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$

📝 Integer Number

🟢 simple

Match positive/negative integers

🏷️ regex, regular-expression, pattern, validation, number, integer, basic
^-?\d+$

📝 Decimal Number

🟢 simple

Match decimal numbers with optional sign

🏷️ regex, regular-expression, pattern, validation, number, decimal, basic
^-?\d+(?:\.\d+)?$

📝 Email Address

🟡 intermediate

Validate email addresses format

🏷️ regex, regular-expression, pattern, validation, email, contact
^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$

📝 URL / Web Address

🟡 intermediate

Match HTTP/HTTPS URLs

🏷️ regex, regular-expression, pattern, validation, url, web, http, https
^https?:\/\/(?:www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b(?:[-a-zA-Z0-9()@:%_\+.~#?&\/=]*)$

📝 IPv4 Address

🟡 intermediate

Validate IPv4 addresses

🏷️ regex, regular-expression, pattern, validation, ip, ipv4, network
^(?:(?: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]?)$

📝 US Phone Number

🟡 intermediate

Match US phone number formats

🏷️ regex, regular-expression, pattern, validation, phone, us, contact
^(\+?1[-.\s]?)?\(?[0-9]{3}\)?[-.\s]?[0-9]{3}[-.\s]?[0-9]{4}$

📝 Strong Password

🟡 intermediate

Validate strong password (min 8 chars, uppercase, lowercase, number, special)

🏷️ regex, regular-expression, pattern, validation, password, security
^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,}$

📝 US Social Security Number

🟡 intermediate

Validate SSN format

🏷️ regex, regular-expression, pattern, validation, ssn, us, identification
^(?!000|666)[0-8]\d{2}-(?!00)\d{2}-(?!0000)\d{4}$

📝 HTML Tag

🟡 intermediate

Match HTML tags

🏷️ regex, regular-expression, pattern, validation, html, tag, web
^<([a-z]+)([^<]+)*(?:>(.*)<\/\1>|\s+\/>)$

📝 UUID / GUID

🟡 intermediate

Validate UUID format

🏷️ regex, regular-expression, pattern, validation, uuid, guid, identifier
^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$

📝 MAC Address

🟡 intermediate

Validate MAC address format

🏷️ regex, regular-expression, pattern, validation, mac, network, hardware
^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$

📝 IPv6 Address

🔴 complex

Validate IPv6 addresses

🏷️ regex, regular-expression, pattern, validation, ip, ipv6, network, advanced
^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]+|::(ffff(:0{1,4})?:)?((25[0-5]|(2[0-4]|1?[0-9])?[0-9])\.){3}(25[0-5]|(2[0-4]|1?[0-9])?[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1?[0-9])?[0-9])\.){3}(25[0-5]|(2[0-4]|1?[0-9])?[0-9]))$

📝 Credit Card Number

🔴 complex

Match major credit card numbers

🏷️ regex, regular-expression, pattern, validation, credit-card, payment, financial, advanced
^(?:4[0-9]{12}(?:[0-9]{3})?|(?:5[1-5][0-9]{14}|2(?:2[2-9][0-9]{2}|[3-6][0-9]{3}|7(?:[01][0-9]{2}|20[0-9]))[0-9]{12})|6(?:011|5[0-9]{2})[0-9]{12}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|(?:2131|1800|35\d{3})\d{11})$