Skip to content
Regex Pattern Library

Regex Pattern Library

Regular expression patterns organized by use case — email, phone, URL, date, IP address, password, UUID, and more. Each pattern includes a line-by-line breakdown, matching and non-matching examples, code snippets in JavaScript and Python, and common pitfalls.

Contact & Identity

  • Email Address
  • US Phone Number
  • International Phone
  • Credit Card
  • SSN
  • Username / Slug
  • Password Strength

Web & Network

  • URL
  • IPv4
  • IPv6
  • MAC Address
  • HTML Tag
  • UUID
  • File Extension

Dates & Times

  • Date — YYYY-MM-DD
  • Date — MM/DD/YYYY
  • Time (HH:MM)
  • ISO 8601 DateTime

Codes & Formats

  • ZIP / Postal Code
  • Hex Color
  • Base64
  • CVV
  • UK Postcode
  • Canadian Postal Code
  • SemVer
  • ISBN
  • Latitude/Longitude

Text & Formatting

  • Domain Name
  • Alphanumeric
  • Numbers

Pages in this section

Regex for Email Validation — Pattern Explained with Examples

The standard regex pattern for validating email addresses according to RFC 5322 — matches local part, @ symbol, and domain with subdomains.

✓ Live

Regex for US Phone Numbers — Pattern Explained with Examples

The regex pattern for validating US phone numbers in various formats — with or without country code, parentheses, dashes, and dots.

✓ Live

Regex for International Phone Numbers — Pattern Explained with Examples

A flexible regex pattern for validating international phone numbers with country codes — supports E.164 format and common writing styles.

✓ Live

Regex for URL Validation — Pattern Explained with Examples

A comprehensive regex pattern for validating URLs — supports HTTP, HTTPS, FTP, subdomains, paths, query strings, and fragments.

✓ Live

Regex for IPv4 Address — Pattern Explained with Examples

The regex pattern for validating IPv4 addresses — matches each of four octets (0-255) separated by dots with boundary enforcement.

✓ Live

Regex for IPv6 Address — Pattern Explained with Examples

The regex pattern for validating IPv6 addresses — supports 8 groups of 4 hex digits, shorthand (::), and mixed IPv4-IPv6 notation.

✓ Live

Regex for MAC Address — Pattern Explained with Examples

The regex pattern for validating MAC addresses — supports colon, hyphen, and no-separator formats for 48-bit hardware addresses.

✓ Live

Regex for HTML Tags — Pattern Explained with Examples

The regex pattern for matching HTML tags — supports opening, closing, self-closing tags, and attributes with quoted values.

✓ Live

Regex for Credit Card Numbers — Pattern Explained with Examples

Regex patterns for credit card number validation — supports Visa, Mastercard, American Express, Discover, and general Luhn-compatible formats.

✓ Live

Regex for UUID — Pattern Explained with Examples

The regex pattern for validating UUIDs (Universally Unique Identifiers) — matches all 5 UUID versions in standard 8-4-4-4-12 hex format.

✓ Live

Regex for Date (YYYY-MM-DD) — Pattern Explained with Examples

The regex pattern for validating dates in YYYY-MM-DD format — validates year, month (01-12), and day (01-31) with separators.

✓ Live

Regex for Date (MM/DD/YYYY) — Pattern Explained with Examples

The regex pattern for validating dates in US MM/DD/YYYY format — validates month, day, and 4-digit year with forward slash separator.

✓ Live

Regex for Time (HH:MM) — Pattern Explained with Examples

The regex pattern for validating time in 12-hour and 24-hour formats — validates hours and minutes with optional seconds and AM/PM.

✓ Live

Regex for ISO 8601 Date/Time — Pattern Explained with Examples

The regex pattern for validating ISO 8601 date-time format — combines date, time, timezone offset in the standard international format.

✓ Live

Regex for ZIP/Postal Code — Pattern Explained with Examples

The regex pattern for validating US ZIP codes — supports 5-digit and ZIP+4 formats with optional hyphen.

✓ Live

Regex for Social Security Number — Pattern Explained with Examples

The regex pattern for validating US Social Security Numbers (SSN) — validates XXX-XX-XXXX format with valid area/group ranges.

✓ Live

Regex for Hex Color Codes — Pattern Explained with Examples

The regex pattern for validating hexadecimal color codes — supports 3-digit and 6-digit hex colors with optional # prefix.

✓ Live

Regex for Password Strength — Pattern Explained with Examples

The regex pattern for validating password strength — enforces minimum length, uppercase, lowercase, digit, and special character requirements.

✓ Live

Regex for Username/Slug — Pattern Explained with Examples

The regex pattern for validating usernames and URL slugs — alphanumeric characters with underscores, hyphens, and 3-20 character length.

✓ Live

Regex for File Extension — Pattern Explained with Examples

The regex pattern for extracting and validating file extensions — matches the extension part of a filename after the last dot.

✓ Live

Regex for Base64 — Pattern Explained with Examples

The regex pattern for validating Base64 encoded strings — matches standard A-Za-z0-9+/ padding with correct length constraints.

✓ Live

Regex for Domain Name — Pattern Explained with Examples

The regex pattern for validating domain names — matches subdomains, TLDs, and follows DNS label rules (not starting with hyphen, max 253 chars).

✓ Live

Regex for Alphanumeric — Pattern Explained with Examples

The regex pattern for validating alphanumeric strings — matches letters (A-Z, a-z) and digits (0-9) with configurable length and optional spaces.

✓ Live

Regex for Numbers (Integer & Decimal) — Pattern Explained with Examples

The regex pattern for validating integer and decimal numbers — supports positive/negative, optional decimals, leading zeros, and scientific notation.

✓ Live

Regex for CVV — Pattern Explained with Examples

The regex pattern for validating credit card CVV/CVC codes — matches 3-digit (Visa, MC, Discover) and 4-digit (Amex) security codes.

✓ Live

Regex for UK Postcode — Pattern Explained with Examples

The regex pattern for validating UK postcodes — matches the format [A-Z][A-Z]?[0-9][A-Z0-9]? [0-9][A-Z]{2} with required space.

✓ Live

Regex for Canadian Postal Code — Pattern Explained with Examples

The regex pattern for validating Canadian postal codes — matches A#A #A# format with alternating letter-digit pattern and required space.

✓ Live

Regex for Semantic Version (SemVer) — Pattern Explained with Examples

The regex pattern for validating semantic version numbers — matches MAJOR.MINOR.PATCH format with optional pre-release and build metadata.

✓ Live

Regex for ISBN — Pattern Explained with Examples

The regex pattern for validating ISBN-10 and ISBN-13 — matches both formats with optional hyphens and validates check digit position.

✓ Live

Regex for Coordinates (Latitude/Longitude) — Pattern Explained with Examples

The regex pattern for validating geographic coordinates — matches latitude (-90 to 90) and longitude (-180 to 180) in decimal degrees format.

✓ Live