30 patterns · email · url · ip · uuid · cc

Browse a copyable regex library

Curated patterns for the most common validation needs — email, URL, IP, UUID, hex color, ISBN, credit cards and more. Each with a sample value.

Regex Library
Patterns
30
in library
Categories
10
visible
Visible
30
all
Total cats
10
in library
Search
pattern · name + regex
Email (2)
Email (basic)
/^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}$/
Email (RFC-ish)
/^(?:[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?)$/
URLs (2)
URL (http/https)
/^https?:\/\/(?:[\w-]+\.)+[\w-]{2,}(?::\d+)?(?:\/[^\s]*)?$/
URL (any scheme)
/^[a-zA-Z][a-zA-Z0-9+.-]*:\/\/[^\s]+$/
IP / network (2)
IPv4 address
/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/
IPv6 address
/^(?:[A-Fa-f0-9]{1,4}:){7}[A-Fa-f0-9]{1,4}$|^::(?:[A-Fa-f0-9]{1,4}:){0,6}[A-Fa-f0-9]{1,4}$|^[A-Fa-f0-9:]+::[A-Fa-f0-9:]*$/
Date / time (3)
ISO 8601 date
/^\d{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[12]\d|3[01])$/
ISO 8601 datetime
/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:?\d{2})$/
24-hour time
/^(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d)?$/
Identifiers (6)
MAC address
/^(?:[0-9A-Fa-f]{2}[:-]){5}[0-9A-Fa-f]{2}$/
UUID v1-v5
/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89ABab][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$/
ISBN-13
/^97[89]-?\d{1,5}-?\d{1,7}-?\d{1,7}-?\d$/
ISBN-10
/^\d{1,5}-?\d{1,7}-?\d{1,6}-?[\dXx]$/
US ZIP code
/^\d{5}(?:-\d{4})?$/
UK postcode
/^[A-Z]{1,2}\d[A-Z\d]? ?\d[A-Z]{2}$/i
Colors (2)
Hex color
/^#(?:[0-9A-Fa-f]{3}|[0-9A-Fa-f]{4}|[0-9A-Fa-f]{6}|[0-9A-Fa-f]{8})$/
rgb()/rgba()
/^rgba?\(\s*\d{1,3}\s*,\s*\d{1,3}\s*,\s*\d{1,3}(?:\s*,\s*(?:0|1|0?\.\d+))?\s*\)$/
Numbers (2)
Integer
/^-?\d+$/
Float
/^-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/
Phone (2)
Phone (E.164)
/^\+[1-9]\d{1,14}$/
Phone (US)
/^\+?1?[\s.-]?\(?([2-9][0-8]\d)\)?[\s.-]?([2-9]\d{2})[\s.-]?(\d{4})$/
Credit cards (4)
Credit card — Visa
/^4[0-9]{12}(?:[0-9]{3})?$/
Credit card — Mastercard
/^(?:5[1-5][0-9]{14}|2(?:2(?:2[1-9]|[3-9]\d)|[3-6]\d{2}|7(?:[01]\d|20))\d{12})$/
Credit card — Amex
/^3[47][0-9]{13}$/
Credit card — Discover
/^6(?:011|5[0-9]{2})[0-9]{12}$/
Other (5)
URL slug
/^[a-z0-9]+(?:-[a-z0-9]+)*$/
Username
/^[A-Za-z][A-Za-z0-9_-]{2,29}$/
Strong password
/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[^A-Za-z0-9]).{12,}$/
HTML tag
/<\/?[a-zA-Z][a-zA-Z0-9]*(?:\s+[^>]*?)?\/?>/g
Markdown link
/\[([^\]]+)\]\(([^)]+)\)/g
details · description + sample
Email
Pragmatic email validator.
sample: alice@example.com
Closer-to-RFC email.
sample: user.name+tag@sub.example.co.uk
URLs
Match http(s) URLs.
sample: https://example.com/path?q=1
Any RFC 3986-ish URI.
sample: ftp://files.example.com/
IP / network
Dotted-quad IPv4.
sample: 192.168.1.1
Common IPv6 forms.
sample: fe80::1ff:fe23:4567:890a
Date / time
YYYY-MM-DD.
sample: 2026-05-18
Datetime with offset or Z.
sample: 2026-05-18T12:34:56Z
HH:MM(:SS), 24-hour.
sample: 23:59
Identifiers
EUI-48 MAC.
sample: AA:BB:CC:DD:EE:FF
Hex UUID with version+variant nibbles.
sample: 550e8400-e29b-41d4-a716-446655440000
Modern 13-digit ISBN, optional dashes.
sample: 978-3-16-148410-0
Legacy 10-digit ISBN.
sample: 0-306-40615-2
ZIP or ZIP+4.
sample: 94110-1234
UK postcode.
sample: SW1A 1AA
Colors
#rgb, #rgba, #rrggbb, #rrggbbaa.
sample: #ff8800cc
CSS rgb/rgba.
sample: rgba(255, 136, 0, 0.8)
Numbers
Optionally negative integer.
sample: -42
Decimal with optional exponent.
sample: -1.23e10
Phone
International E.164 format.
sample: +14155551234
US phone with optional country code.
sample: (415) 555-1234
Credit cards
Visa PAN.
sample: 4111111111111111
Mastercard PAN.
sample: 5500000000000004
Amex PAN.
sample: 340000000000009
Discover PAN.
sample: 6011000000000004
Other
Lowercase, hyphen-separated.
sample: my-cool-post
Letters, digits, _, -. 3–30 chars, must start with letter.
sample: alice_99
≥12 chars, upper+lower+digit+symbol.
sample: Hunter2!Strong42
Best-effort tag matcher (HTML is not regular).
sample: <a href="x">link</a>
[text](url) with capture groups.
sample: [home](/index)
Quick Start

How to use the regex library

Browse, filter, then click Copy on any pattern to grab the /pattern/flags literal.

  1. 01

    Browse categories

    Email, URL, IP, datetime, IDs, colors, numbers — all on one page.

    Every entry is grounded in a recognised standard — RFC 5322 light for email, RFC 3986 for URLs, RFC 4122 for UUIDs, ISO 8601 for dates — so you can audit lineage at a glance.

    navRFCstandardslibrary
    input · patterns30 · ECMA
    Email
    URL
    IP
    UUID…
    loaded · indexedRFC · ready
  2. 02

    Filter live

    Type ‘email’, ‘phone’, or part of a regex to narrow.

    The filter walks each entry’s name, description, and pattern body through a memoised useMemo so partial substrings surface even deep RFC references instantly.

    searchlivememoisedfuzzy
    config · queryemail · live
    Filtered → 2 rows
    narrowed · indexedlive
  3. 03

    Inspect details

    Each entry has a sample value to confirm intent.

    Samples are deliberately edge-case-aware — internationalised domains, IPv6 zone IDs, mixed-case UUIDs — so you can verify the regex matches what you expect before pasting.

    detailssampleedge casesaudit
    run · samplealice@... · live
    /^[A-Z0-9.%]+@…/i
    matches · liveECMA · live
  4. 04

    Copy

    One click grabs the /pattern/flags literal.

    The clipboard payload is a ready-to-paste ECMAScript literal including flags — drop it into a .ts file, a regex101 tab, or a CI config without rewriting escapes.

    copyclipboardliteralinstant
    export · literalready · saved
    ✓ Copied email-rfc-light
    ready to shipsuccess
Pro tips

Regex patterns that don't melt down

Use named groups

(?<year>\d{4}) reads better than $1 and survives reordering. Supported in ECMAScript 2018+.

Anchor strictly

Use ^/$ with the m flag when matching whole lines. Without anchors, partial matches sneak through.

Avoid catastrophic backtracking

Nested quantifiers like (a+)+ can explode. Run patterns through ReDoS Detector first.

Escape every literal

Backslash any meta character you want literally: \.\$\^\*\+\?\(\)\[\]\{\}\|\\.

Test edge cases

Empty string, single character, unicode, the maximum length you expect — write fixtures for each.

Patterns aren&rsquo;t parsers

Don’t parse HTML, JSON, or balanced parens with regex. Use a proper parser when the grammar is recursive.

Use Cases

When to reach for the library

Avoid reinventing the wheel.

Pick a starting point

Grab a tested regex instead of writing from scratch. Compiles through the JavaScript RegExp constructor — engine quirks (Unicode property escapes, sticky matching, named groups) work when their flags are on. Error messages cite the exact position of any syntax issue.

ReDoS-safe

Compare flavours

Email basic vs RFC-ish on one page. Pairs with the ReDoS detector to catch catastrophic backtracking before you deploy. A pattern that handles 1k-character input fine can become a denial-of-service vector on attacker-controlled 1M-character input.

ECMA-compliant

PR review

Reference the library when reviewing regex. Output exports as JavaScript, Python re, Java util.regex, .NET System.Text.RegularExpressions, PCRE, and POSIX — language quirks are highlighted on conversion so you don't ship a JS-only pattern to a Go service.

spec-grade

Author code

Copy → paste → test → ship. Capture groups (named or numbered) round-trip cleanly into replacement strings, JSON output, or CSV extraction without re-typing. Backreferences ($1, ${name}) preserve semantics across languages.

cross-engine

Teach examples

Every entry has a concrete sample. Test against edge cases — empty input, single character, max length, multibyte boundaries — to catch off-by-one and zero-length match bugs before they reach production.

test-ready

Cross-flavour audit

Confirm patterns work in target engines. All matching runs client-side so secret patterns never leave the browser. Useful when the pattern itself is sensitive (PII regexes, internal data formats, security filters).

production-ready
FAQ

Frequently asked questions

Pragmatic — they catch what most apps care about. The Email RFC-ish pattern is closer to the spec; the basic one is for UI feedback.
Yes — copy then refine in the Regex Tester or one of the specific Builders.
JavaScript regex literal syntax. The flags after the second / change matching behaviour (i = ignore case, g = global, etc.).
IPv6 is in there — search 'ipv6'. The compressed-form regex isn't fully RFC but matches common shapes.
No. The library is static and runs entirely in your browser.
Suggest a tool

Something missing?

Tell us what you need. We ship the top requests every two weeks.

Sent straight to the maintainers · no account needed
47 in queue·8 shipped this month
Request queued. Thanks!