R
Regex Master
TutorialsToolsFAQAboutContact

Common Regex Library

A curated collection of the most useful regular expression patterns for everyday development. Search, test, and copy snippets for your projects.

Email Address (RFC 5322)

Validation

Matches a valid email address according to RFC 5322 standard. Covers 99.9% of use cases.

Regex
Copied!
^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$
Matches
[email protected][email protected]
Does Not Match
user@@example.com[email protected]

Complex Password

Validation

Enforces a strong password: Minimum 8 characters, at least one uppercase letter, one lowercase letter, one number and one special character.

Regex
Copied!
^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,}$
Matches
P@ssw0rd123SuperS3cr3t!
Does Not Match
password12345678Pass123

Username

Validation

Alphanumeric string that may include _ and - having a length of 3 to 16 characters.

Regex
Copied!
^[a-zA-Z0-9_-]{3,16}$
Matches
my_user-nameuser123
Does Not Match
ususer@namethis_username_is_too_long

URL (Web Address)

Web

Matches standard URLs (HTTP/HTTPS), with or without www.

Regex
Copied!
https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)
Matches
https://www.google.comhttp://example.com/path?query=1
Does Not Match
google.comhtp://error

IPv4 Address

Web

Matches a valid IPv4 address (0.0.0.0 to 255.255.255.255).

Regex
Copied!
^(?:(?: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]?)$
Matches
192.168.1.1127.0.0.1
Does Not Match
256.256.256.2561.2.3

Hex Color Code

Web

Matches hex color codes with or without # prefix, supporting both 3 and 6 digit formats.

Regex
Copied!
^#?([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$
Matches
#FFF#000000a3c
Does Not Match
#12#GGGGGG

URL Slug

Web

Matches URL-friendly slugs (lowercase alphanumeric with hyphens).

Regex
Copied!
^[a-z0-9]+(?:-[a-z0-9]+)*$
Matches
my-blog-postregex-tutorial-101
Does Not Match
My Postinvalid_slug

Date (YYYY-MM-DD)

Data

Matches dates in ISO 8601 format (YYYY-MM-DD). Does not validate leap years or days in month.

Regex
Copied!
^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$
Matches
2023-12-312024-01-01
Does Not Match
2023/12/3131-12-2023

Time (24 Hour)

Data

Matches time in 24-hour format (HH:MM).

Regex
Copied!
^([01]\d|2[0-3]):([0-5]\d)$
Matches
13:0009:3023:59
Does Not Match
24:0013:609:30

UUID / GUID

Data

Matches a standard UUID (Universally Unique Identifier).

Regex
Copied!
^[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}$
Matches
123e4567-e89b-12d3-a456-426614174000
Does Not Match
123-456-789

US Phone Number

Contact

Matches US phone numbers in various formats: (555) 555-5555, 555-555-5555, 555.555.5555.

Regex
Copied!
^\(?([2-9][0-9]{2})\)?[-. ]?([2-9][0-9]{2})[-. ]?([0-9]{4})$
Matches
(555) 123-4567555-123-4567
Does Not Match
123-456-78905551234567

HTML Tag

Code

Matches simple HTML tags and their content.

Regex
Copied!
<([a-z]+)([^<]+)*(?:>(.*)<\/\1>|\s+\/>)
Matches
<div class="test">Content</div><br />
Does Not Match
<divtext only

Why use these patterns?

✅ Validated

All patterns are tested against common use cases to ensure accuracy and reliability.

⚡️ Optimized

Crafted for performance to avoid catastrophic backtracking and ensure fast matching.

🛡️ Secure

Includes security-focused patterns like strict password validation and input sanitization.

🔥

Popular Patterns

📧

Email Address

Validate standard email formats. Includes support for common domains and subdomains.

Try Email Regex →
📅

Dates (YYYY-MM-DD)

Match dates in ISO 8601 format. Validates year, month, and day structure.

Try Date Regex →
📱

US Phone Number

Match various US phone formats including dashes, dots, and parentheses.

Try Phone Regex →
🌐

IPv4 Address

Validate IPv4 addresses with proper range checking (0-255).

Try IP Regex →
R
Regex Master

Your comprehensive guide to mastering regular expressions through tutorials and tools.

Company

  • About Us
  • Contact
  • FAQ

Resources

  • All Articles
  • Popular Tools
  • Sitemap

Legal

  • Privacy Policy
  • Terms of Service
  • Cookie Policy
  • Disclaimer

© 2026 Regex Master. All rights reserved.