ad

Regex Library

Browse, search, and test common regex patterns — copy with one click.

Email Address

Validates standard email addresses

^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$

URL

Matches HTTP/HTTPS URLs

https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&/=]*)

Phone (International)

E.164 international phone format

\+?[1-9]\d{1,14}

Phone (US)

US phone numbers with optional formatting

\(?\d{3}\)?[-.\s]?\d{3}[-.\s]?\d{4}

IPv4 Address

Validates IPv4 addresses (0.0.0.0 - 255.255.255.255)

\b(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\b

IPv6 Address

Matches full IPv6 addresses

([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}

MAC Address

Matches MAC addresses

([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})

Credit Card

Visa, Mastercard, Amex, Discover

\b(?:4\d{12}(?:\d{3})?|5[1-5]\d{14}|3[47]\d{13}|6(?:011|5\d{2})\d{12})\b

Hex Color

Matches 3 or 6 digit hex colors

#?([a-fA-F0-9]{6}|[a-fA-F0-9]{3})\b

HTML Tags

Matches opening and closing HTML tags

<\/?[a-z][\s\S]*?>

Quoted String

Matches single or double quoted strings

"([^"\\]|\\.)*"|'([^'\\]|\\.)*'

Slug

URL-friendly slug format

^[a-z0-9]+(?:-[a-z0-9]+)*$

Whitespace Trim

Matches leading/trailing whitespace

^\s+|\s+$

Duplicate Words

Finds repeated consecutive words

\b(\w+)\s+\1\b

Integer

Positive or negative integers

^-?\d+$

Decimal Number

Decimal/float numbers

^-?\d*\.\d+$

Date (YYYY-MM-DD)

ISO 8601 date format

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

Date (MM/DD/YYYY)

US date format

(?:0[1-9]|1[0-2])\/(?:0[1-9]|[12]\d|3[01])\/\d{4}

Time (HH:MM)

24-hour time format

(?:[01]\d|2[0-3]):[0-5]\d

Currency

US dollar amounts

\$\d{1,3}(,\d{3})*(\.\d{2})?

Strong Password

Min 8 chars, upper, lower, digit, special

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

UUID v4

UUID version 4 format

[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}

JWT Token

JSON Web Token format

eyJ[A-Za-z0-9-_]+\.eyJ[A-Za-z0-9-_]+\.[A-Za-z0-9-_.+/=]+

Base64

Base64 encoded string

^[A-Za-z0-9+/]+=*$

JS Variable

Valid JavaScript variable name

^[a-zA-Z_$][a-zA-Z0-9_$]*$

Semver

Semantic versioning (major.minor.patch)

\bv?\d+\.\d+\.\d+(?:-[\w.]+)?(?:\+[\w.]+)?\b

Import Statement

ES module import statements

import\s+(?:{[^}]+}|\w+)\s+from\s+['"][^'"]+['"]

CSS Class

CSS class selectors

\.[a-zA-Z_][a-zA-Z0-9_-]*

Single-line Comment

JS/TS single-line comments

\/\/.*$
29 / 29 patterns shown

What is this tool?

A searchable library of commonly used regular expressions. Find the right regex for emails, URLs, dates, passwords, and more — then test it and copy it.

Categories

  • Validation — Email, URL, phone, IP, credit card
  • Strings & Text — HTML tags, quoted strings, slugs
  • Numbers & Dates — Integers, dates, currency
  • Security — Passwords, UUID, JWT, Base64
  • Programming — Variables, semver, imports
ad