Intosoft Tools
๐Ÿ“‹

Common Regex Patterns

Production-ready regular expressions for common validation tasks. Copy-paste these patterns into your code with confidence.

Contact

Email (Basic)

Validates most common email formats

^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$
Examples:user@example.comtest.name+tag@domain.co.uk

Email (RFC 5322)

Strict RFC 5322 compliant (complex)

(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?: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]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])
Examples:complex+tag@sub.domain.com

Phone Numbers

US Phone

US format with optional separators

^\(?([0-9]{3})\)?[-. ]?([0-9]{3})[-. ]?([0-9]{4})$
Examples:(123) 456-7890123-456-78901234567890

International Phone

E.164 international format

^\+?[1-9]\d{1,14}$
Examples:+14155552671+442071234567

URLs & Web

URL (HTTP/HTTPS)

HTTP/HTTPS URLs with query params

^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)$
Examples:https://example.com/path?q=valuehttp://sub.domain.co.uk

Domain Name

Valid domain names

^(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$
Examples:example.comsub.domain.co.uk

URL Slug

URL-friendly slugs

^[a-z0-9]+(?:-[a-z0-9]+)*$
Examples:hello-worldmy-blog-post-123

Network

IPv4 Address

Valid IPv4 with range validation

^(?:(?: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]?)$
Examples:192.168.1.110.0.0.255

IPv6 Address

Full IPv6 format

^(?:[0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$
Examples:2001:0db8:85a3:0000:0000:8a2e:0370:7334

MAC Address

Network MAC address

^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$
Examples:00:1A:2B:3C:4D:5E00-1A-2B-3C-4D-5E

Date & Time

Date (YYYY-MM-DD)

ISO 8601 date format

^\d{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[12][0-9]|3[01])$
Examples:2024-12-252023-01-01

Date (MM/DD/YYYY)

US date format

^(?:0[1-9]|1[0-2])\/(?:0[1-9]|[12][0-9]|3[01])\/\d{4}$
Examples:12/25/202401/01/2023

Time (24-hour)

24-hour time with optional seconds

^(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d)?$
Examples:14:3023:59:59

ISO 8601 DateTime

Full ISO 8601 datetime

^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})?$
Examples:2024-12-25T14:30:00Z2024-12-25T14:30:00+05:30

Financial

Credit Card (All)

Visa, MasterCard, Amex, Discover

^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|3[47][0-9]{13}|6(?:011|5[0-9]{2})[0-9]{12})$
Examples:41111111111111115500000000000004

Currency Amount

US currency format

^\$?\d{1,3}(?:,\d{3})*(?:\.\d{2})?$
Examples:$1,234.561234.56$100

Security

Strong Password

Min 8 chars, upper, lower, digit, special

^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,}$
Examples:SecureP@ss1MyP@ssw0rd!

UUID v4

Version 4 UUID format

^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$
Examples:550e8400-e29b-41d4-a716-446655440000

MD5 Hash

32-character hex MD5

^[a-fA-F0-9]{32}$
Examples:d41d8cd98f00b204e9800998ecf8427e

SHA-256 Hash

64-character hex SHA-256

^[a-fA-F0-9]{64}$
Examples:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855

Code & Identifiers

Hex Color

3 or 6 digit hex color

^#?([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$
Examples:#FFF#336699ff5733

RGB Color

RGB color function

^rgb\(\s*\d{1,3}\s*,\s*\d{1,3}\s*,\s*\d{1,3}\s*\)$
Examples:rgb(255, 128, 0)rgb(0,0,0)

HTML Tag

Basic HTML tag matching

<([a-z]+)([^<]+)*(?:>(.*)<\/\1>|\s+\/>)
Examples:<div>content</div><br />

Semantic Version

SemVer 2.0 compliant

^(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-]+)*))?$
Examples:1.0.02.1.3-beta.11.2.3+build.456

Text

Alphanumeric Only

Letters and numbers only

^[a-zA-Z0-9]+$
Examples:Hello123ABC

Username

3-16 chars, letters, numbers, underscore

^[a-zA-Z0-9_]{3,16}$
Examples:john_doeuser123

No Special Characters

Alphanumeric with spaces

^[a-zA-Z0-9 ]+$
Examples:Hello WorldTest 123

Contains Only Letters

Latin letters only

^[a-zA-Z]+$
Examples:HelloWorld

๐Ÿ’ก Tips for Using These Patterns

  • Test thoroughly: These patterns cover common cases but may need adjustment for edge cases in your specific application.
  • Consider performance: Complex patterns with many alternations or lookarounds can be slow on large inputs.
  • Escape in strings: When using in JavaScript/Python strings, you may need to double-escape backslashes (\\\\d โ†’ \\d).
  • Add flags as needed: Use /i for case-insensitive, /g for global matching.

Test Patterns Instantly!

Copy a pattern and test it with your own data in real-time.

๐Ÿ“Open Regex Tester