@Mention
/@[A-Za-z0-9_]{3,30}/Matches a social media @mention — @ followed by 3–30 word characters.
106 curated, battle-tested regex patterns with live testing, multi-language code generation, and Zod integration. Click any pattern to open it in the sandbox.
/@[A-Za-z0-9_]{3,30}/Matches a social media @mention — @ followed by 3–30 word characters.
/\d{2}\s?\d{3}\s?\d{3}\s?\d{3}/Matches an Australian Business Number (ABN) — 11 digits, optionally space-separated in groups.
/arn:(?:aws|aws-cn|aws-us-gov):([a-z0-9\-]+):([a-z0-9\-]*):([0-9]{12}|\*)?:(.+)/Validates Amazon Web Services ARNs (Amazon Resource Names) across all AWS services and partitions.
/^(?:[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.
/^([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.
/[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.
/bc1[ac-hj-np-z02-9]{6,87}/iMatches a Bitcoin native SegWit address in Bech32 format — starts with bc1 followed by 6–87 lowercase alphanumeric characters.
/\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.
/\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.
/[0-9]{3}[\s\-]?[0-9]{3}[\s\-]?[0-9]{3}/Validates Canadian Social Insurance Numbers (SIN): 9 digits optionally formatted as NNN-NNN-NNN.
/\d{17}[\dXx]/Matches a Chinese national resident identity card number — 17 digits followed by one digit or X (checksum digit).
/(feat|fix|docs|style|refactor|perf|test|build|ci|chore|revert)(?:\([a-zA-Z0-9_-]+\))?!?: .{1,100}/Validates git commit messages adhering to the Conventional Commits specification.
/(?: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.
/(?:(?:\*|\d+(?:-\d+)?)(?:\/\d+)?(?:,(?:\*|\d+(?:-\d+)?)(?:\/\d+)?)*\s+){4}(?:\*|\d+(?:-\d+)?)(?:\/\d+)?(?:,(?:\*|\d+(?:-\d+)?)(?:\/\d+)?)*/Validates cron schedule expressions (5 fields: minute, hour, day of month, month, day of week) structurally.
/--[a-zA-Z0-9_-]+/Validates CSS custom property (variable) names starting with double dashes (--).
/oklch\(\s*(?:none|[0-9]*\.?[0-9]+%?)\s+(?:none|[0-9]*\.?[0-9]+)\s+(?:none|[0-9]*\.?[0-9]+(?:deg)?)(?:\s*\/\s*(?:[0-9]*\.?[0-9]+%?))?\s*\)/iValidates CSS oklch() color function values as defined in CSS Color Level 4. Supports lightness (0–1), chroma (0–0.4), hue (0–360), and optional alpha.
/(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.
/(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.
/[MNOT][A-Za-z0-9_-]{23,25}\.[A-Za-z0-9_-]{6}\.[A-Za-z0-9_-]{27,38}/Validates Discord bot API tokens consisting of user ID base64, timestamp, and HMAC hash.
/(?:[a-z0-9][a-z0-9.\-]*(?::[0-9]+)?/)?[a-z0-9][a-z0-9._\-]*(?:/[a-z0-9._\-]+)*(?::[a-zA-Z0-9._\-]+|@sha256:[a-f0-9]{64})?/Validates Docker image references including optional registry host, namespace, name, tag, and digest.
/(?:[a-zA-Z0-9](?:[a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}/iMatches a valid domain name including subdomains and international TLDs.
/[a-zA-Z0-9._%+\-]+@[a-zA-Z0-9.\-]+\.[a-zA-Z]{2,}/iRFC 5321 compliant email address validation. Supports subdomains, plus-addressing, and international TLDs.
/[a-z0-9][a-z0-9\-]{1,61}[a-z0-9]\.eth/iMatches an Ethereum Name Service domain — alphanumeric label(s) ending with .eth.
/0x[a-fA-F0-9]{40}/iMatches an Ethereum address — 0x followed by exactly 40 hexadecimal characters.
/0x[a-fA-F0-9]{64}/Matches an Ethereum transaction hash — 0x followed by exactly 64 hexadecimal characters.
/(?:ATU[0-9]{8}|BE[0-9]{10}|BG[0-9]{9,10}|CY[0-9]{8}[A-Z]|CZ[0-9]{8,10}|DE[0-9]{9}|DK[0-9]{8}|EE[0-9]{9}|EL[0-9]{9}|ES[A-Z0-9][0-9]{7}[A-Z0-9]|FI[0-9]{8}|FR[A-Z0-9]{2}[0-9]{9}|HR[0-9]{11}|HU[0-9]{8}|IE[0-9]{7}[A-Z]{1,2}|IT[0-9]{11}|LT(?:[0-9]{9}|[0-9]{12})|LU[0-9]{8}|LV[0-9]{11}|MT[0-9]{8}|NL[0-9]{9}B[0-9]{2}|PL[0-9]{10}|PT[0-9]{9}|RO[0-9]{2,10}|SE[0-9]{12}|SI[0-9]{8}|SK[0-9]{10})/iValidates European Union VAT numbers across all 27 member states. Each country has a 2-letter ISO prefix followed by 8–12 alphanumeric characters.
/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.
/\d{9}/Matches a French SIREN (Système d'Identification du Répertoire des ENtreprises) number — 9 digits.
/\d{14}/Matches a French SIRET (Système d'Identification du Répertoire des Établissements) number — 14 digits.
/(?:\+49|0)[\s.\-]?(?:\(\d{1,5}\)|\d{1,5})[\s.\-]?\d{1,9}(?:[\s.\-]\d{1,9})*/Validates German phone numbers in international (+49) and domestic (0) formats, with optional spaces, hyphens, or dots as separators.
/\d{5}/Matches a German postal code (Postleitzahl / PLZ) — exactly 5 digits.
/[1-9]\d{10}/Matches a German personal tax identification number (Steuerliche Identifikationsnummer) — 11 digits, first digit 1–9.
/(?:[a-zA-Z0-9_.-]+(?:\/[a-zA-Z0-9_.-]+)*)/Validates standard Git branch names (e.g. feature/login, bugfix/issue-123, main, release/v1.0.4).
/[0-9a-f]{7,40}/iMatches a Git commit SHA — either short form (7+ chars) or full 40-character SHA-1 hash.
/[a-zA-Z0-9](?:[a-zA-Z0-9._\-]{0,37}[a-zA-Z0-9])?/[a-zA-Z0-9][a-zA-Z0-9._\-]{0,98}/Validates GitHub repository references in owner/repo format. Owner and repo names must be 1–100 characters and contain only alphanumerics, hyphens, underscores, or dots.
/-?([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.
/#[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.
/#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})/CSS hex color code in #RGB or #RRGGBB format (case-insensitive).
/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*\)/iMatches a CSS HSL color value in the format hsl(H, S%, L%).
/<([a-zA-Z][a-zA-Z0-9]*)\b[^>]*\/?>/gMatches an HTML opening or self-closing tag with optional attributes.
/[A-Z]{2}\d{2}[A-Z0-9]{4}\d{7}([A-Z0-9]?){0,16}/iMatches an International Bank Account Number (IBAN) — 2-letter country code, 2 check digits, and up to 30 alphanumeric characters.
/[A-Z]{5}\d{4}[A-Z]/Matches an Indian Permanent Account Number (PAN) — 10 characters: 5 uppercase letters, 4 digits, 1 uppercase letter.
/(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).
/(?: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.
/([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}/iMatches a full-form IPv6 address with 8 groups of 4 hexadecimal digits separated by colons.
/(?:978|979)[- ]?\d{1,5}[- ]?\d{1,7}[- ]?\d{1,7}[- ]?\d{1}/Validates 13-digit International Standard Book Numbers (ISBN-13) with optional hyphens or spaces.
/\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.
/\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).
/[A-Z]{6}\d{2}[A-Z]\d{2}[A-Z]\d{3}[A-Z]/iMatches an Italian fiscal code (Codice Fiscale) — 16 alphanumeric characters encoding name, birth date, gender, and municipality.
/[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.
/-?([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.
/ln(bc|tb|bcrt)\d*[munp]?[a-z0-9]+/iMatches a Bitcoin Lightning Network payment invoice in BOLT-11 format — starts with lnbc, lntb, or lnbcrt.
/-?(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.
/([0-9a-fA-F]{2}[:\-]){5}[0-9a-fA-F]{2}/iMatches a MAC (Media Access Control) address in both colon-separated and hyphen-separated formats.
/^>+\s?(.+)$/mMatches a Markdown blockquote line beginning with > and captures the quoted text.
/(\*\*|__)(?!\s)(.+?)(?<!\s)\1/sMatches Markdown bold text wrapped in **double asterisks** or __double underscores__.
/^(#{1,6})\s+(.+)$/mMatches Markdown ATX-style headings — # through ###### followed by text. Captures both the level (number of #) and the heading text.
/^([-*_])\s*\1\s*\1(?:\s|\1)*$/mMatches a Markdown horizontal rule — three or more dashes, asterisks, or underscores on a line.
/!\[([^\]]*)\]\(([^)]+)\)/gMatches a Markdown image tag  and captures both the alt text and the URL.
/(`{1,2})([^`]+)\1/Matches Markdown inline code wrapped in single `backticks` or ``double backticks``.
/(\*|_)(?!\s)(.+?)(?<!\s)\1/Matches Markdown italic text wrapped in *single asterisk* or _single underscore_.
/\[([^\]]+)\]\(([^)]+)\)/gMatches a Markdown hyperlink in [text](url) format and captures both the link text and URL.
/^(\s*)([-*+]|\d+\.)\s+(.+)$/mMatches Markdown unordered list items starting with -, *, or + and ordered items starting with a number.
/^\|(.+\|)+$/mMatches a Markdown GFM table row — cells separated by pipe | characters.
/[a-fA-F0-9]{32}/Matches an MD5 hash — exactly 32 hexadecimal characters.
/(?:application|audio|font|example|image|message|model|multipart|text|video)\/[a-zA-Z0-9!#$&^_.+-]+(?:\s*;\s*[a-zA-Z0-9._-]+=[a-zA-Z0-9._-]+)*/iValidates standard MIME / media type strings (e.g. application/json, image/png, text/html).
/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.
/mongodb(?:\+srv)?:\/\/(?:[a-zA-Z0-9-_]+:[a-zA-Z0-9-_]+@)?[a-zA-Z0-9.-]+(?::\d+)?(?:\/[a-zA-Z0-9-_]+)?(?:\?.+)?/Validates MongoDB connection strings, supporting both standard 'mongodb://' and DNS-seedlist 'mongodb+srv://' protocols.
/(?:@[a-z0-9-~][a-z0-9-._~]*\/)?[a-z0-9-~][a-z0-9-._~]*/Validates scoped and unscoped NPM package names according to npm naming rules.
/sk-proj-[a-zA-Z0-9]{40,100}/Validates OpenAI API keys, specifically supporting the standard project keys starting with 'sk-proj-'.
/\+[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).
/(\+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.
/(\+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.
/(?:\d{10}|\d{3}-\d{3}-\d{2}-\d{2}|\d{3}-\d{2}-\d{2}-\d{3})/Polish NIP (Numer Identyfikacji Podatkowej) — the 10-digit tax identification number used by businesses and self-employed individuals in Poland, supported in unhyphenated and official hyphenated formats.
/\d{11}/Polish national identification number (PESEL) — an 11-digit number encoding date of birth, gender, and a checksum, assigned to every citizen.
/(?:\d{9}|\d{14})/Matches a Polish REGON (National Business Registry Number) — 9 digits for businesses and companies, 14 digits for local administrative units.
/(?:PL)?[ -]?(?:\d{10}|\d{3}-\d{3}-\d{2}-\d{2}|\d{3}-\d{2}-\d{2}-\d{3})/iValidates Polish VAT identification numbers (VAT-UE / NIP do celów VAT). Matches standard 10-digit NIP numbers with optional or required 'PL' country prefix and official Polish hyphenation formats.
/(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.
/rediss?:\/\/(?:(?:[^:]+)?(?::(?:[^@]+))?@)?(?:[a-zA-Z0-9.-]+|\d{1,3}(?:\.\d{1,3}){3}):\d{1,5}(?:\/\d{1,2})?/Validates Redis and Redis SSL connection URLs (redis://, rediss://) with optional user, password, port, and DB index.
/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*\)/iMatches an RGB color value in the format rgb(R, G, B) where each channel is 0–255.
/(\d{10}|\d{12})/Matches a Russian taxpayer identification number (ИНН) — 10 digits for organisations, 12 digits for individuals.
/(?: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.
/(?:[\^~]|>=?|<=?|==?)?\s*v?(?:0|[1-9]\d*)(?:\.(?:0|[1-9]\d*|\*|x))?(?:\.(?:0|[1-9]\d*|\*|x))?(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?/Validates Semantic Versioning (SemVer) ranges such as ^1.2.3, ~0.1.0, >=1.0.0, or 1.x.
/[a-fA-F0-9]{64}/Matches a SHA-256 cryptographic hash — exactly 64 hexadecimal characters.
/https:\/\/hooks\.slack\.com\/services\/T[a-zA-Z0-9_]{8,11}\/B[a-zA-Z0-9_]{8,11}\/[a-zA-Z0-9_]{24}/Validates Slack incoming webhook URLs (https://hooks.slack.com/services/T.../B.../...).
/[1-9A-HJ-NP-Za-km-z]{32,44}/Matches a Solana public key — 32–44 Base58 characters (no 0, O, I, l).
/[0-9XYZ]\d{7}[A-HJ-NP-TV-Z]/iMatches a Spanish National Identity Document number (NIF/DNI) — 8 digits followed by a letter, or an NIE starting with X, Y, or Z.
/[a-zA-Z_][a-zA-Z0-9_]*|"[a-zA-Z_][a-zA-Z0-9_]*"|`[a-zA-Z_][a-zA-Z0-9_]*`/Validates SQL table, column, and schema names (unquoted or quoted with double quotes or backticks).
/(ssh-rsa|ssh-dss|ssh-ed25519|ecdsa-sha2-nistp256|ecdsa-sha2-nistp384|ecdsa-sha2-nistp521)\s+[A-Za-z0-9+/=]+(?:\s+.+)?/Validates SSH public keys, supporting common algorithms like ssh-rsa, ssh-ed25519, ssh-dss, and ecdsa variants.
/(?:pk|sk|rk)_(?:live|test)_[a-zA-Z0-9]{20,99}/Validates Stripe publishable and secret API keys in both live and test modes.
/(?=.*[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.
/[A-Z]{6}[A-Z0-9]{2}([A-Z0-9]{3})?/iMatches a SWIFT/BIC (Bank Identifier Code) — 6-letter institution code + 2-letter country + optional 2-3 character branch.
/([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.
/[A-CEGHJ-PR-TW-Z]{2}\s?\d{2}\s?\d{2}\s?\d{2}\s?[A-D]/iMatches a UK National Insurance Number in the format AA 99 99 99 A.
/\d{3}[\s\-]?\d{3}[\s\-]?\d{4}/Validates UK National Health Service (NHS) numbers: 10 digits optionally separated by spaces in groups of 3-3-4.
/[A-Z]{1,2}\d[A-Z\d]?\s?\d[A-Z]{2}/iMatches a UK postcode in the standard format (e.g. SW1A 1AA, EC1A 1BB).
/[0-7][0-9A-HJKMNP-TV-Z]{25}/iValidates 26-character Crockford Base32 Universally Unique Lexicographically Sortable Identifier (ULID) strings.
/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&\/=]*)/iValidates HTTP and HTTPS URLs including subdomains, paths, query strings, and anchors.
/[a-z0-9]+(?:-[a-z0-9]+)*/Valid URL slug — lowercase alphanumeric characters separated by single hyphens, no leading or trailing hyphens.
/\d{2}-\d{7}/Matches a US EIN (Federal Tax ID) in the NN-NNNNNNN format used by the IRS.
/[A-Z]{1,2}[0-9]{7,8}/Validates United States passport numbers: 9 alphanumeric characters starting with 1-2 letters followed by digits.
/\d{3}-\d{2}-\d{4}/Matches a US Social Security Number (SSN) in the standard NNN-NN-NNNN format.
/\d{5}(-\d{4})?/Matches a US ZIP code in 5-digit or ZIP+4 (5-4) format.
/^[a-zA-Z0-9](?!.*[-_]{2})[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.
/[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}/iMatches a UUID version 4 — randomly generated universally unique identifier in the standard 8-4-4-4-12 format.
/(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/watch\?v=|youtu\.be\/)([a-zA-Z0-9_\-]{11})/iMatches a YouTube video URL in both youtube.com/watch?v= and youtu.be/ formats and extracts the 11-character video ID.