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)
Validate ISO 8601 date format
^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$
📝 24-Hour Time Format
Validate time in HH:MM format
^([01]\d|2[0-3]):[0-5]\d$
📝 Username
Validate username (alphanumeric, underscore, hyphen)
^[a-zA-Z0-9_-]{3,16}$
📝 US Postal Code (ZIP)
Validate US ZIP code format
^\d{5}(-\d{4})?$
📝 Hexadecimal Color Code
Match hex color codes (#RGB or #RRGGBB)
^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$
📝 Integer Number
Match positive/negative integers
^-?\d+$
📝 Decimal Number
Match decimal numbers with optional sign
^-?\d+(?:\.\d+)?$
📝 Email Address
Validate email addresses format
^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$
📝 URL / Web Address
Match HTTP/HTTPS URLs
^https?:\/\/(?:www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b(?:[-a-zA-Z0-9()@:%_\+.~#?&\/=]*)$
📝 IPv4 Address
Validate 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]?)$
📝 US Phone Number
Match US phone number formats
^(\+?1[-.\s]?)?\(?[0-9]{3}\)?[-.\s]?[0-9]{3}[-.\s]?[0-9]{4}$
📝 Strong Password
Validate strong password (min 8 chars, uppercase, lowercase, number, special)
^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,}$
📝 US Social Security Number
Validate SSN format
^(?!000|666)[0-8]\d{2}-(?!00)\d{2}-(?!0000)\d{4}$
📝 HTML Tag
Match HTML tags
^<([a-z]+)([^<]+)*(?:>(.*)<\/\1>|\s+\/>)$
📝 UUID / GUID
Validate UUID format
^[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
Validate MAC address format
^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$
📝 IPv6 Address
Validate IPv6 addresses
^(([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
Match major credit card numbers
^(?: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})$