Launching a SaaS?·Collect waitlist signups before you build — before.run
SandboxPatternsDetectDocs

Pattern Catalog

79 curated, battle-tested regex patterns with live testing, multi-language code generation, and Zod integration. Click any pattern to open it in the sandbox.

79Patterns
15Categories
4Languages
Social

@Mention

/@[A-Za-z0-9_]{3,30}/

Matches a social media @mention — @ followed by 3–30 word characters.

#mention#social#username
Identity

Australian ABN

/\d{2}\s?\d{3}\s?\d{3}\s?\d{3}/

Matches an Australian Business Number (ABN) — 11 digits, optionally space-separated in groups.

#abn#australia#australian
Security

Base64 Encoded String

/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/

Matches a valid Base64-encoded string with proper padding using = characters.

#base64#encoding#data
Crypto

BIP-39 Mnemonic Phrase

/^([a-z]+\s){11,23}[a-z]+$/

Matches a BIP-39 mnemonic seed phrase — 12, 15, 18, 21, or 24 lowercase English words separated by single spaces.

#bip39#mnemonic#seed
Crypto

Bitcoin Address (Legacy)

/[13][a-km-zA-HJ-NP-Z1-9]{25,34}/

Matches a legacy Bitcoin address — P2PKH (starting with 1) or P2SH (starting with 3), 25–34 Base58 characters.

#bitcoin#btc#crypto
Crypto

Bitcoin Bech32 Address (SegWit)

/bc1[ac-hj-np-z02-9]{6,87}/i

Matches a Bitcoin native SegWit address in Bech32 format — starts with bc1 followed by 6–87 lowercase alphanumeric characters.

#bitcoin#btc#bech32
Identity

Brazilian CNPJ

/\d{2}\.?\d{3}\.?\d{3}\/?\d{4}-?\d{2}/

Matches a Brazilian CNPJ (Cadastro Nacional da Pessoa Jurídica) — company identifier in formatted or unformatted form.

#cnpj#brazil#company
Identity

Brazilian CPF

/\d{3}\.?\d{3}\.?\d{3}-?\d{2}/

Matches a Brazilian CPF (Cadastro de Pessoas Físicas) number in formatted (NNN.NNN.NNN-NN) or unformatted (NNNNNNNNNNN) form.

#cpf#brazil#brazilian
Identity

Chinese Resident ID

/\d{17}[\dXx]/

Matches a Chinese national resident identity card number — 17 digits followed by one digit or X (checksum digit).

#china#chinese#resident-id
Finance

Credit Card Number

/(?:4[0-9]{12}(?:[0-9]{3})?|[25][1-7][0-9]{14}|6(?:011|5[0-9][0-9])[0-9]{12}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|(?:2131|1800|35\d{3})\d{11})/

Generic credit card number validator supporting Visa, Mastercard, American Express, and Discover card formats.

#payment#credit-card#finance
Date & Time

Date (European Format)

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

Matches a European-style date in DD/MM/YYYY, DD.MM.YYYY, or DD-MM-YYYY format.

#date#european#dd/mm/yyyy
Date & Time

Date (US Format)

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

Matches a US-style date in MM/DD/YYYY format.

#date#us#mm/dd/yyyy
Internet

Domain Name

/(?:[a-zA-Z0-9](?:[a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}/i

Matches a valid domain name including subdomains and international TLDs.

#domain#internet#dns
Internet

Email Address

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

RFC 5321 compliant email address validation. Supports subdomains, plus-addressing, and international TLDs.

#email#internet#contact
Crypto

ENS Name (Ethereum Name Service)

/[a-z0-9][a-z0-9\-]{1,61}[a-z0-9]\.eth/i

Matches an Ethereum Name Service domain — alphanumeric label(s) ending with .eth.

#ens#ethereum#domain
Crypto

Ethereum Address

/0x[a-fA-F0-9]{40}/i

Matches an Ethereum address — 0x followed by exactly 40 hexadecimal characters.

#ethereum#eth#evm
Crypto

Ethereum Transaction Hash

/0x[a-fA-F0-9]{64}/

Matches an Ethereum transaction hash — 0x followed by exactly 64 hexadecimal characters.

#ethereum#eth#txhash
Address

French Postal Code

/0[1-9]\d{3}|[1-8]\d{4}|9[0-5]\d{3}/

Matches a French postal code — exactly 5 digits, starting with 0–9.

#postal#france#french
Identity

French SIREN Number

/\d{9}/

Matches a French SIREN (Système d'Identification du Répertoire des ENtreprises) number — 9 digits.

#siren#france#company
Identity

French SIRET Number

/\d{14}/

Matches a French SIRET (Système d'Identification du Répertoire des Établissements) number — 14 digits.

#siret#france#company
Address

German Postal Code (PLZ)

/\d{5}/

Matches a German postal code (Postleitzahl / PLZ) — exactly 5 digits.

#plz#postal#germany
Identity

German Tax ID (Steuer-IdNr)

/[1-9]\d{10}/

Matches a German personal tax identification number (Steuerliche Identifikationsnummer) — 11 digits, first digit 1–9.

#steuerid#germany#german
Dev

Git Commit SHA

/[0-9a-f]{7,40}/i

Matches a Git commit SHA — either short form (7+ chars) or full 40-character SHA-1 hash.

#git#sha#commit
Geo

GPS Coordinates

/-?([0-8]?\d(\.\d+)?|90(\.0+)?)\s*,\s*-?(1[0-7]\d(\.\d+)?|[0-9]?\d(\.\d+)?|180(\.0+)?)/

Matches a latitude,longitude coordinate pair separated by a comma.

#coordinates#gps#geo
Social

Hashtag

/#[A-Za-z][A-Za-z0-9_]*/

Matches a social media hashtag — # followed by one or more word characters (letters, digits, underscores), starting with a letter.

#hashtag#social#twitter
Web

Hex Color

/#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})/

CSS hex color code in #RGB or #RRGGBB format (case-insensitive).

#color#css#hex
Design

HSL Color

/hsl\(\s*(360|3[0-5]\d|[12]\d{2}|[1-9]\d|\d)\s*,\s*(100|[1-9]\d|\d)%\s*,\s*(100|[1-9]\d|\d)%\s*\)/i

Matches a CSS HSL color value in the format hsl(H, S%, L%).

#hsl#color#css
Web

HTML Tag

/<([a-zA-Z][a-zA-Z0-9]*)\b[^>]*\/?>/g

Matches an HTML opening or self-closing tag with optional attributes.

#html#tag#web
Finance

IBAN

/[A-Z]{2}\d{2}[A-Z0-9]{4}\d{7}([A-Z0-9]?){0,16}/i

Matches an International Bank Account Number (IBAN) — 2-letter country code, 2 check digits, and up to 30 alphanumeric characters.

#iban#bank#finance
Identity

Indian PAN Card

/[A-Z]{5}\d{4}[A-Z]/

Matches an Indian Permanent Account Number (PAN) — 10 characters: 5 uppercase letters, 4 digits, 1 uppercase letter.

#pan#india#indian
Crypto

IPFS CID

/(Qm[1-9A-HJ-NP-Za-km-z]{44}|b[a-z2-7]{58,})/

Matches an IPFS Content Identifier (CIDv0 starting with Qm, or CIDv1 starting with bafy/bafk).

#ipfs#cid#content-address
Network

IPv4 Address

/(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.(?:25[0-5]|2[0-4]\d|[01]?\d\d?)/

Validates a standard IPv4 address ensuring each octet is 0–255.

#ip#ipv4#networking
Network

IPv6 Address

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

Matches a full-form IPv6 address with 8 groups of 4 hexadecimal digits separated by colons.

#ipv6#network#internet
Date & Time

ISO 8601 Date

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

ISO 8601 date format (YYYY-MM-DD) with month and day range validation.

#date#iso#time
Date & Time

ISO 8601 DateTime

/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[+-]\d{2}:\d{2})/

Matches an ISO 8601 datetime string with timezone offset or Z (UTC).

#iso8601#datetime#timestamp
Identity

Italian Codice Fiscale

/[A-Z]{6}\d{2}[A-Z]\d{2}[A-Z]\d{3}[A-Z]/i

Matches an Italian fiscal code (Codice Fiscale) — 16 alphanumeric characters encoding name, birth date, gender, and municipality.

#codice-fiscale#italy#italian
Security

JWT Token

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

Matches a JSON Web Token (JWT) — three Base64URL-encoded segments separated by dots.

#jwt#token#auth
Geo

Latitude

/-?([0-8]?\d(\.\d{1,6})?|90(\.0{1,6})?)/

Matches a geographic latitude coordinate between -90 and +90 degrees, with up to 6 decimal places.

#latitude#geo#coordinates
Crypto

Lightning Network Invoice (BOLT-11)

/ln(bc|tb|bcrt)\d*[munp]?[a-z0-9]+/i

Matches a Bitcoin Lightning Network payment invoice in BOLT-11 format — starts with lnbc, lntb, or lnbcrt.

#lightning#bitcoin#bolt11
Geo

Longitude

/-?(1[0-7]\d(\.\d{1,6})?|[0-9]?\d(\.\d{1,6})?|180(\.0{1,6})?)/

Matches a geographic longitude coordinate between -180 and +180 degrees, with up to 6 decimal places.

#longitude#geo#coordinates
Network

MAC Address

/([0-9a-fA-F]{2}[:\-]){5}[0-9a-fA-F]{2}/i

Matches a MAC (Media Access Control) address in both colon-separated and hyphen-separated formats.

#mac#network#hardware
Markdown

Markdown Blockquote

/^>+\s?(.+)$/m

Matches a Markdown blockquote line beginning with > and captures the quoted text.

#markdown#blockquote#quote
Markdown

Markdown Bold

/(\*\*|__)(?!\s)(.+?)(?<!\s)\1/s

Matches Markdown bold text wrapped in **double asterisks** or __double underscores__.

#markdown#bold#strong
Markdown

Markdown Heading

/^(#{1,6})\s+(.+)$/m

Matches Markdown ATX-style headings — # through ###### followed by text. Captures both the level (number of #) and the heading text.

#markdown#heading#h1
Markdown

Markdown Horizontal Rule

/^([-*_])\s*\1\s*\1[\s\1]*$/m

Matches a Markdown horizontal rule — three or more dashes, asterisks, or underscores on a line.

#markdown#horizontal-rule#hr
Markdown

Markdown Image

/!\[([^\]]*)\]\(([^)]+)\)/g

Matches a Markdown image tag ![alt text](url) and captures both the alt text and the URL.

#markdown#image#img
Markdown

Markdown Inline Code

/(`{1,2})([^`]+)\1/

Matches Markdown inline code wrapped in single `backticks` or ``double backticks``.

#markdown#code#inline
Markdown

Markdown Italic

/(\*|_)(?!\s)(.+?)(?<!\s)\1/

Matches Markdown italic text wrapped in *single asterisk* or _single underscore_.

#markdown#italic#emphasis
Web

Markdown Link

/\[([^\]]+)\]\(([^)]+)\)/g

Matches a Markdown hyperlink in [text](url) format and captures both the link text and URL.

#markdown#link#url
Markdown

Markdown List Item

/^(\s*)([-*+]|\d+\.)\s+(.+)$/m

Matches Markdown unordered list items starting with -, *, or + and ordered items starting with a number.

#markdown#list#ul
Markdown

Markdown Table Row

/^\|(.+\|)+$/m

Matches a Markdown GFM table row — cells separated by pipe | characters.

#markdown#table#gfm
Security

MD5 Hash

/[a-fA-F0-9]{32}/

Matches an MD5 hash — exactly 32 hexadecimal characters.

#md5#hash#checksum
Crypto

Monero Address

/4[0-9AB][1-9A-HJ-NP-Za-km-z]{93}/

Matches a Monero (XMR) standard address — starts with 4 and is exactly 95 Base58 characters.

#monero#xmr#crypto
Phone

Phone — E.164 International

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

Matches an international phone number in E.164 format: + followed by country code and subscriber number (max 15 digits total).

#phone#e164#international
Phone

Phone — UK

/(\+44\s?|0)(\d{2,4}\s?\d{3,4}\s?\d{3,4}|\d{10})/

Matches UK phone numbers in standard formats, starting with 0 or +44.

#phone#uk#british
Phone

Phone — US

/(\+1[\s\-]?)?\(?\d{3}\)?[\s\-]?\d{3}[\s\-]?\d{4}/

Matches a US phone number in various formats: (555) 867-5309, 555-867-5309, 5558675309, or with +1 country code.

#phone#us#american
Finance

Polish NIP (Tax ID)

/\d{10}/

Polish NIP (Numer Identyfikacji Podatkowej) — the 10-digit tax identification number used by businesses and self-employed individuals in Poland.

#poland#nip#tax
Identity

Polish PESEL

/\d{11}/

Polish national identification number (PESEL) — an 11-digit number encoding date of birth, gender, and a checksum, assigned to every citizen.

#poland#pesel#identity
Identity

Polish REGON

/(\d{9}|\d{14})/

Matches a Polish REGON (National Business Registry Number) — 9 digits for companies, 14 digits for local units.

#regon#poland#polish
Network

Port Number

/(6553[0-5]|655[0-2]\d|65[0-4]\d{2}|6[0-4]\d{3}|[1-5]\d{4}|[1-9]\d{0,3}|0)/

Matches a valid TCP/UDP port number from 0 to 65535.

#port#network#tcp
Design

RGB Color

/rgb\(\s*(25[0-5]|2[0-4]\d|1?\d\d?)\s*,\s*(25[0-5]|2[0-4]\d|1?\d\d?)\s*,\s*(25[0-5]|2[0-4]\d|1?\d\d?)\s*\)/i

Matches an RGB color value in the format rgb(R, G, B) where each channel is 0–255.

#rgb#color#css
Identity

Russian INN (ИНН)

/(\d{10}|\d{12})/

Matches a Russian taxpayer identification number (ИНН) — 10 digits for organisations, 12 digits for individuals.

#inn#russia#russian
Dev

Semantic Version

/(?: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-]+)*)?/

SemVer 2.0 compliant version string including optional pre-release and build metadata.

#semver#version#npm
Security

SHA-256 Hash

/[a-fA-F0-9]{64}/

Matches a SHA-256 cryptographic hash — exactly 64 hexadecimal characters.

#sha256#hash#crypto
Crypto

Solana Address

/[1-9A-HJ-NP-Za-km-z]{32,44}/

Matches a Solana public key — 32–44 Base58 characters (no 0, O, I, l).

#solana#sol#crypto
Identity

Spanish NIF / DNI

/[0-9XYZ]\d{7}[A-HJ-NP-TV-Z]/i

Matches a Spanish National Identity Document number (NIF/DNI) — 8 digits followed by a letter, or an NIE starting with X, Y, or Z.

#nif#dni#nie
Security

Strong Password

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

Matches a strong password: minimum 8 characters with at least one uppercase letter, one lowercase letter, one digit, and one special character.

#password#security#auth
Finance

SWIFT / BIC Code

/[A-Z]{6}[A-Z0-9]{2}([A-Z0-9]{3})?/i

Matches a SWIFT/BIC (Bank Identifier Code) — 6-letter institution code + 2-letter country + optional 2-3 character branch.

#swift#bic#bank
Date & Time

Time (24-hour)

/([01]?[0-9]|2[0-3]):[0-5][0-9](:[0-5][0-9])?/

Matches a time in 24-hour format. Supports both HH:MM and HH:MM:SS.

#time#24h#clock
Identity

UK National Insurance Number (NINO)

/[A-CEGHJ-PR-TW-Z]{2}\s?\d{2}\s?\d{2}\s?\d{2}\s?[A-D]/i

Matches a UK National Insurance Number in the format AA 99 99 99 A.

#nino#uk#national-insurance
Address

UK Postcode

/[A-Z]{1,2}\d[A-Z\d]?\s?\d[A-Z]{2}/i

Matches a UK postcode in the standard format (e.g. SW1A 1AA, EC1A 1BB).

#postcode#postal#uk
Internet

URL (HTTP/HTTPS)

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

Validates HTTP and HTTPS URLs including subdomains, paths, query strings, and anchors.

#url#internet#link
Web

URL Slug

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

Valid URL slug — lowercase alphanumeric characters separated by single hyphens, no leading or trailing hyphens.

#slug#url#web
Identity

US Employer Identification Number (EIN)

/\d{2}-\d{7}/

Matches a US EIN (Federal Tax ID) in the NN-NNNNNNN format used by the IRS.

#ein#us#tax
Identity

US Social Security Number

/\d{3}-\d{2}-\d{4}/

Matches a US Social Security Number (SSN) in the standard NNN-NN-NNNN format.

#ssn#us#identity
Address

US ZIP Code

/\d{5}(-\d{4})?/

Matches a US ZIP code in 5-digit or ZIP+4 (5-4) format.

#zip#postal#us
Social

Username

/[a-zA-Z0-9](?:[a-zA-Z0-9_\-]{1,18}[a-zA-Z0-9])?/

Matches a valid username: 3–20 characters, letters, digits, hyphens, and underscores. No leading/trailing hyphens or underscores.

#username#user#handle
Security

UUID v4

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

Matches a UUID version 4 — randomly generated universally unique identifier in the standard 8-4-4-4-12 format.

#uuid#guid#identifier
Internet

YouTube Video URL

/(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/watch\?v=|youtu\.be\/)([a-zA-Z0-9_\-]{11})/i

Matches a YouTube video URL in both youtube.com/watch?v= and youtu.be/ formats and extracts the 11-character video ID.

#youtube#video#url