Download Cheat sheet PDF 12 pages · syntax, editors, patterns, Unicode, performance, debugging
Pattern library

300 regex patterns, ready to copy.

Curated for real-world use. Each pattern has tested examples, edge-case notes, and code-generation across 7 languages.

Identity & contact 22

Email address

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

Standard email validation.

Username

^[a-zA-Z][a-zA-Z0-9_-]{2,19}$

Alphanumeric username, 3–20 characters, starts with a letter.

Full name

^[A-Za-z\u00C0-\u017F][A-Za-z\u00C0-\u017F'\- ]+$

Full name with Unicode letters, apostrophes, and hyphens.

US phone number

^\+?1?[-.\s]?\(?\d{3}\)?[-.\s]?\d{3}[-.\s]?\d{4}$

North American phone in any common format.

International phone (E.164)

^\+[1-9]\d{6,14}$

The international standard: + and 7–15 digits.

URL / web address

^https?://[^\s/$.?#].[^\s]*$

HTTP or HTTPS URL with optional path, query, and fragment.

Domain name

^(?!-)[A-Za-z0-9-]{1,63}(?<!-)(\.[A-Za-z0-9-]{1,63…

Bare domain with optional subdomain.

URL slug

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

Lowercase URL slug — letters, digits, hyphens.

Hashtag

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

Social media hashtag — # followed by letters/digits/underscore.

@Mention

@[A-Za-z][A-Za-z0-9_]{1,29}

@-mention in social media or chat — @ followed by username.

IPv4 address

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

IPv4 address with octet range validation.

IPv6 address

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

IPv6 address with abbreviations supported.

MAC address

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

MAC address with colon or hyphen separators.

MAC address (Cisco format)

^[0-9a-fA-F]{4}\.[0-9a-fA-F]{4}\.[0-9a-fA-F]{4}$

Cisco-style dotted MAC: XXXX.XXXX.XXXX.

Twitter/X handle

@([A-Za-z0-9_]{1,15})\b

Twitter @handle — 1-15 alphanumeric/underscore.

Instagram handle

^@?[a-zA-Z0-9._]{1,30}$

Instagram username — letters, digits, dots, underscores.

GitHub username

^[A-Za-z0-9](?:[A-Za-z0-9]|-(?=[A-Za-z0-9])){0,3…

GitHub username — alphanumeric + single hyphen, no leading/trailing hyphen.

YouTube video ID

^[A-Za-z0-9_-]{11}$

11-character YouTube video identifier.

LinkedIn profile URL

^https?:\/\/(www\.)?linkedin\.com\/in\/[A-Za-z0-…

linkedin.com/in/handle URL.

Discord username (new)

^[a-z0-9._]{2,32}$

Discord username — 2-32 lowercase letters/digits/dot/underscore.

Spotify URI

^spotify:(track|album|playlist|artist|episode|sh…

spotify:track/album/playlist URI.

Phone with extension

^.+(\s+(ext\.?|x|extension)\s*\d+)$

Phone number followed by ext./x and digits.

Date & time 16

ISO 8601 date (YYYY-MM-DD)

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

The international date format.

ISO 8601 datetime

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

Full ISO datetime with optional fractional seconds and timezone.

US date (MM/DD/YYYY)

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

Slash-separated US date format.

EU / Indian date (DD/MM/YYYY)

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

Day-first date format used in most of the world.

24-hour time (HH:MM)

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

Time in 24-hour format with optional seconds.

12-hour time (with AM/PM)

^(0?[1-9]|1[0-2]):[0-5]\d\s?(AM|PM|am|pm)$

12-hour time with AM/PM marker.

Timezone offset

^[+-](0\d|1[0-4]):?[0-5]\d$

UTC offset in ±HH:MM or ±HHMM format.

ISO 8601 duration

^P(?!$)(\d+Y)?(\d+M)?(\d+D)?(T(\d+H)?(\d+M)?(\d+(\…

Duration like P1Y2M3DT4H5M6S.

Unix timestamp (seconds)

^\d{10}$

10-digit Unix epoch in seconds.

Unix timestamp (milliseconds)

^\d{13}$

13-digit Unix epoch in milliseconds.

RFC 2822 date

^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), \d{1,2} (Jan|Feb…

Email-style date format like RFC 2822.

ISO 8601 week date

^\d{4}-W(0[1-9]|[1-4]\d|5[0-3])-[1-7]$

YYYY-Www-D format ISO week date.

Month name

^(January|February|March|April|May|June|July|Aug…

English month name, full or abbreviated.

Day of week name

^(Monday|Tuesday|Wednesday|Thursday|Friday|Satur…

English day name, full or abbreviated.

Year + quarter

^(Q[1-4][\s\-/]?\d{4}|\d{4}[\s\-/]?Q[1-4])$

Quarter format like Q1 2024 or 2024-Q1.

Cron expression (5-field)

^(\*|[0-5]?\d|\*\/\d+|[0-5]?\d-[0-5]?\d|[0-5]?\d…

Standard 5-field cron: minute hour day month weekday.

Numbers & text 22

Positive integer

^(0|[1-9]\d*)$

Non-negative whole number, no leading zeros.

Signed integer

^-?(0|[1-9]\d*)$

Integer with optional minus sign.

Decimal number

^-?\d+(\.\d+)?$

Decimal with optional sign and fractional part.

Currency amount (USD)

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

Dollar amount with optional cents and commas.

Scientific notation

^-?\d+(\.\d+)?[eE][+-]?\d+$

Numbers in scientific notation like 6.022e23.

Letters only

^[A-Za-z]+$

String of letters only (A–Z, a–z).

Alphanumeric

^[A-Za-z0-9]+$

Letters and digits only, no spaces or symbols.

Whitespace (multiple/leading/trailing)

\s+

Match runs of whitespace for trimming or collapsing.

Quoted string

(["\'])(?:(?=(\\?))\2.)*?\1

Match either single- or double-quoted strings.

Between two strings

BEGIN(.*?)END

Extract content between two known markers.

Emoji (Unicode)

[\u{1F300}-\u{1F9FF}\u{2600}-\u{27BF}]

Match common Unicode emoji characters.

Positive decimal

^\d+(\.\d+)?$

Non-negative decimal number, optional fraction.

Percentage (0-100%)

^(100(\.0+)?|\d{1,2}(\.\d+)?)\s*%?$

Percentage value with optional decimals and % sign.

Euro amount

^€?\s?-?\d{1,3}([.,]\d{3})*([.,]\d{2})?\s?€?$

Euro amount in €1,234.56 or 1.234,56 € format.

Pound Sterling amount

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

British pound amount like £1,234.56.

Japanese Yen amount

^¥?-?\d{1,3}(,\d{3})*$

Yen amount like ¥1,234 (no decimal places).

Fraction (N/M)

^-?\d+\/\d+$

Simple fraction like 1/2, 3/4, 22/7.

Roman numerals

^M{0,3}(CM|CD|D?C{0,3})(XC|XL|L?X{0,3})(IX|IV|V?…

Standard Roman numerals (I, IV, IX, X, etc.).

Ordinal number

^\d+(st|nd|rd|th)$

Ordinals like 1st, 2nd, 3rd, 21st.

Hex number with 0x prefix

^0[xX][0-9a-fA-F]+$

C/JS style hex literal: 0xABC123.

Binary number with 0b prefix

^0[bB][01]+$

Binary literal: 0b101010.

Octal number with 0o prefix

^0[oO][0-7]+$

Modern octal literal: 0o755.

Codes & IDs 24

UUID / GUID

^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9…

Standard UUID in 8-4-4-4-12 hex format.

UUID v4 specifically

^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89…

Random-generated UUID version 4.

Semantic version

^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0…

Semver version like 1.2.3 with pre-release and build metadata.

JWT token

^[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]*$

JSON Web Token — three base64url segments.

Base64 string

^[A-Za-z0-9+/]+={0,2}$

Base64-encoded data with optional padding.

Git SHA (short)

\b[0-9a-f]{7}\b

7-character abbreviated commit hash.

Git SHA (full)

\b[0-9a-f]{40}\b

Full 40-character SHA-1 commit hash.

MD5 hash

^[0-9a-fA-F]{32}$

32-character MD5 hash.

SHA-1 hash

^[0-9a-fA-F]{40}$

40-character SHA-1 hash.

SHA-256 hash

^[0-9a-fA-F]{64}$

64-character SHA-256 hash.

Hex color

^#([0-9a-fA-F]{3,4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})…

CSS hex color — 3, 4, 6, or 8 hex digits.

ISBN-10

^(?=(?:\D*\d){9}[\dX])\d{1,5}-?\d{1,7}-?\d{1,6}-?[…

10-digit International Standard Book Number.

ISBN-13

^(?=(?:\D*\d){13})97[89][\d-]+$

13-digit International Standard Book Number.

CSS rgb() / rgba() color

^rgba?\(\s*\d+\s*,\s*\d+\s*,\s*\d+\s*(,\s*(0|1|0…

CSS rgb(r, g, b) or rgba(r, g, b, a) value.

CSS hsl() / hsla() color

^hsla?\(\s*\d+(deg)?\s*,\s*\d+%\s*,\s*\d+%\s*(,\…

CSS hsl/hsla color value.

Bitcoin address (legacy)

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

P2PKH or P2SH Bitcoin address — starts with 1 or 3.

Bitcoin SegWit address (bech32)

^(bc1)[02-9ac-hj-np-z]{38,87}$

bc1... Bitcoin SegWit address.

Ethereum address

^0x[a-fA-F0-9]{40}$

0x + 40 hex characters Ethereum address.

Solana address

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

Base58 encoded Solana wallet address (32-44 chars).

PEM-encoded key/certificate

-----BEGIN [A-Z ]+-----[\s\S]+?-----END [A-Z ]+-…

BEGIN ... END envelope of a PEM file.

SSH public key

^(ssh-rsa|ssh-ed25519|ecdsa-sha2-nistp\d+|ssh-ds…

OpenSSH format public key — ssh-rsa, ssh-ed25519, etc.

Generic API key

^[A-Za-z0-9_\-]{20,64}$

Common API key shape — 20-64 alphanumerics with dashes/underscores.

Semver range (npm style)

^([\^~>=<]+)?\d+\.\d+\.\d+(-[a-zA-Z0-9.-]+)?(\+[…

npm semver range — ^1.2.3, ~1.2.3, >=1.0.0, etc.

CUSIP (security ID)

^[0-9A-Z]{9}$

9-character CUSIP — North American security identifier.

Financial 8

Developer 42

HTML tag

<\/?[a-zA-Z][a-zA-Z0-9]*(\s+[a-zA-Z-]+(\s*=\s*("[^…

Match HTML opening, closing, or self-closing tags.

HTML comment

<!--[\s\S]*?-->

HTML <!-- comment --> block.

Line comment (// or #)

(\/\/|#).*$

Single-line comment in C-family or scripting languages.

Block comment (/* */)

\/\*[\s\S]*?\*\/

C-style multi-line comment.

File path (Unix)

^(?:\/|\.{1,2}\/)?(?:[\w.-]+\/)*[\w.-]+$

Absolute or relative Unix-style file path.

File path (Windows)

^[a-zA-Z]:\\(?:[^\\/:*?"<>|\r\n]+\\)*[^\\/:*?"<>|\…

Windows file path with drive letter.

File extension

\.([a-zA-Z0-9]+)$

Match the extension at the end of a filename.

camelCase identifier

^[a-z]+([A-Z][a-z0-9]*)*$

Lowercase first word followed by capitalized words.

snake_case identifier

^[a-z][a-z0-9]*(_[a-z0-9]+)*$

Lowercase words joined with underscores.

kebab-case identifier

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

Lowercase words joined with hyphens.

PascalCase identifier

^[A-Z][a-zA-Z0-9]*$

Capitalized words joined with no separator.

CONSTANT_CASE

^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$

All-uppercase with underscores.

CSS class selector

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

CSS class name with leading dot.

CSS ID selector

#[a-zA-Z_][a-zA-Z0-9_-]*

CSS ID with leading hash.

MIME type

^[a-zA-Z]+\/[a-zA-Z0-9.+-]+$

Internet media type like application/json.

HTTP status code

^[1-5]\d{2}$

3-digit HTTP status code.

Port number

^(6553[0-5]|655[0-2]\d|65[0-4]\d{2}|6[0-4]\d{3}|[1…

TCP/UDP port — 0 to 65535.

TODO / FIXME marker

(TODO|FIXME|HACK|XXX|NOTE)(\([^)]+\))?:\s*(.*)

TODO or FIXME comment marker in code.

Markdown link

\[([^\]]+)\]\(([^)]+)\)

Markdown link in [text](url) format.

Markdown image

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

Markdown image in ![alt](url) format.

YAML key

^([a-zA-Z_][\w-]*)\s*:

YAML key — alphanumeric and dashes followed by colon.

JSON key

"([^"\\]|\\.)*"\s*:

Quoted JSON object key (a property name).

Docker image tag

^[a-z0-9]+([._-][a-z0-9]+)*(/[a-z0-9]+([._-][a-z…

Docker image reference with tag, e.g. ubuntu:22.04.

Kubernetes resource name

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

DNS-1123 label — lowercase alphanumeric and hyphens.

Environment variable reference

\$\{?([A-Z_][A-Z0-9_]*)\}?

$VAR or ${VAR} in shell scripts.

Shell variable assignment

^[A-Za-z_][A-Za-z0-9_]*=

Bash variable assignment — NAME=value.

HTTP header line

^([A-Za-z][A-Za-z0-9-]*):\s*(.+?)\s*$

Header-Name: value format.

XML namespace declaration

xmlns(:[a-zA-Z][\w-]*)?="[^"]*"

xmlns or xmlns:prefix attribute.

HTML entity

&(#\d+|#x[0-9a-fA-F]+|[a-zA-Z]+);

HTML named or numeric character entity.

SQL comment

(--[^\n]*|\/\*[\s\S]*?\*\/)

SQL line comment (--) or block comment (/* */).

Regex flag string

^[gimsuyd]*$

Flag characters used in JS regex literals.

HTTP method

^(GET|POST|PUT|PATCH|DELETE|HEAD|OPTIONS|TRACE|C…

Standard HTTP method verbs.

HTTP 2xx (success)

^2\d{2}$

200-series HTTP success status codes.

HTTP 3xx (redirect)

^3\d{2}$

300-series HTTP redirect status codes.

HTTP 4xx (client error)

^4\d{2}$

400-series client error status codes.

HTTP 5xx (server error)

^5\d{2}$

500-series server error status codes.

URL query parameter

(?:^|[?&])([^=&]+)=([^&]*)

key=value query parameter.

Windows environment variable

%([A-Za-z_][A-Za-z0-9_]*)%

%VAR% style Windows environment variable.

Linux username

^[a-z_][a-z0-9_-]*[$]?$

Standard Linux/Unix username — POSIX rules.

Git branch name

^(?!\/|.*([\/]\.|\/\/|@\{|\\))[^\040\177 ~^:?*\[…

Valid Git branch name — alphanumeric and limited symbols.

GitHub issue reference

(?:[A-Za-z0-9.-]+\/[A-Za-z0-9.-]+)?#\d+

#123 or org/repo#123 reference.

Docker volume mount

^[^:]+:[^:]+(:(ro|rw|z|Z|cached|delegated|consis…

Docker -v host:container[:options] format.

Passwords 3

India 🇮🇳 104

Aadhaar number

^[2-9]\d{11}$

12-digit Indian Unique Identification number.

Aadhaar (with spaces)

^[2-9]\d{3}\s\d{4}\s\d{4}$

Aadhaar displayed as 1234 5678 9012.

Aadhaar (masked)

^X{4}\s?X{4}\s?\d{4}$

Masked Aadhaar showing only last 4 digits.

Aadhaar Virtual ID (VID)

^[2-9]\d{15}$

16-digit Virtual ID — a temporary mapping to Aadhaar.

PAN (Permanent Account Number)

^[A-Z]{5}[0-9]{4}[A-Z]$

10-character tax ID issued by India's Income Tax Department.

PAN — Individual

^[A-Z]{3}P[A-Z][0-9]{4}[A-Z]$

PAN issued specifically to an individual (4th char is P).

TAN (Tax Deduction Account Number)

^[A-Z]{4}\d{5}[A-Z]$

10-character number for entities deducting tax at source.

GSTIN

^[0-9]{2}[A-Z]{5}[0-9]{4}[A-Z][1-9A-Z]Z[0-9A-Z]$

15-character Goods and Services Tax Identification Number.

HSN code

^\d{2}(\d{2}(\d{2}(\d{2})?)?)?$

Harmonized System Nomenclature code for goods (2–8 digits).

SAC code

^99\d{4}$

Services Accounting Code — 6-digit code for services under GST.

UPI ID (VPA)

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

Unified Payments Interface ID — username@psp.

IFSC code

^[A-Z]{4}0[A-Z0-9]{6}$

Indian Financial System Code — 11-character bank branch identifier.

MICR code

^\d{9}$

9-digit Magnetic Ink Character Recognition code on cheques.

Indian bank account number

^\d{9,18}$

Bank account number — 9 to 18 digits.

Indian mobile number

^[6-9]\d{9}$

10-digit Indian mobile, starts with 6, 7, 8, or 9.

Indian mobile with +91

^(\+91[\-\s]?|0)?[6-9]\d{9}$

Indian mobile in international format.

PIN code (postal)

^[1-9]\d{5}$

6-digit Indian postal PIN code.

Voter ID (EPIC)

^[A-Z]{3}\d{7}$

Election Photo Identity Card — 10 chars.

Indian passport number

^[A-PR-WY][1-9]\d\s?\d{4}[1-9]$

Passport number issued by India — 1 letter + 7 digits.

Indian vehicle registration

^[A-Z]{2}[\s\-]?\d{1,2}[\s\-]?[A-Z]{1,3}[\s\-]?\d{…

State code + RTO + series + number.

Indian driving licence

^[A-Z]{2}[\s\-]?\d{2}[\s\-]?(19|20)\d{2}[\s\-]?\d{…

State code + RTO + year + serial.

CIN (Corporate Identification Number)

^[LU]\d{5}[A-Z]{2}\d{4}[A-Z]{3}\d{6}$

21-character ID for Indian companies registered with MCA.

DIN (Director Identification Number)

^\d{8}$

8-digit ID for company directors.

LLPIN (LLP Identification)

^[A-Z]{3}\-\d{4}$

7-character ID for Limited Liability Partnerships.

EPF UAN

^\d{12}$

12-digit Universal Account Number for EPF.

ESI number

^\d{17}$

17-digit Employee State Insurance number.

FSSAI license

^[1-2]\d{13}$

14-digit Food Safety license number.

Indian rupee amount

^(₹|Rs\.?\s?|INR\s?)?\d{1,3}(,\d{2,3})*(\.\d{1,2})…

Rupee amount with ₹ symbol or Rs. prefix.

Indian comma format (lakh/crore)

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

Number in Indian grouping: 1,00,000 not 100,000.

Maharashtra vehicle registration

^MH[\s\-]?\d{1,2}[\s\-]?[A-Z]{1,3}[\s\-]?\d{4}$

Vehicle plate registered in Maharashtra — starts with MH.

Delhi vehicle registration

^DL[\s\-]?\d{1,2}[\s\-]?[A-Z]{1,3}[\s\-]?\d{4}$

Vehicle plate registered in Delhi — starts with DL.

Karnataka vehicle registration

^KA[\s\-]?\d{1,2}[\s\-]?[A-Z]{1,3}[\s\-]?\d{4}$

Vehicle plate registered in Karnataka — starts with KA.

Tamil Nadu vehicle registration

^TN[\s\-]?\d{1,2}[\s\-]?[A-Z]{1,3}[\s\-]?\d{4}$

Vehicle plate registered in Tamil Nadu — starts with TN.

Uttar Pradesh vehicle registration

^UP[\s\-]?\d{1,2}[\s\-]?[A-Z]{1,3}[\s\-]?\d{4}$

Vehicle plate registered in Uttar Pradesh — starts with UP.

Gujarat vehicle registration

^GJ[\s\-]?\d{1,2}[\s\-]?[A-Z]{1,3}[\s\-]?\d{4}$

Vehicle plate registered in Gujarat — starts with GJ.

Andhra Pradesh vehicle registration

^AP[\s\-]?\d{1,2}[\s\-]?[A-Z]{1,3}[\s\-]?\d{4}$

Vehicle plate registered in Andhra Pradesh — starts with AP.

Telangana vehicle registration

^TS[\s\-]?\d{1,2}[\s\-]?[A-Z]{1,3}[\s\-]?\d{4}$

Vehicle plate registered in Telangana — starts with TS.

Rajasthan vehicle registration

^RJ[\s\-]?\d{1,2}[\s\-]?[A-Z]{1,3}[\s\-]?\d{4}$

Vehicle plate registered in Rajasthan — starts with RJ.

Madhya Pradesh vehicle registration

^MP[\s\-]?\d{1,2}[\s\-]?[A-Z]{1,3}[\s\-]?\d{4}$

Vehicle plate registered in Madhya Pradesh — starts with MP.

West Bengal vehicle registration

^WB[\s\-]?\d{1,2}[\s\-]?[A-Z]{1,3}[\s\-]?\d{4}$

Vehicle plate registered in West Bengal — starts with WB.

Kerala vehicle registration

^KL[\s\-]?\d{1,2}[\s\-]?[A-Z]{1,3}[\s\-]?\d{4}$

Vehicle plate registered in Kerala — starts with KL.

Haryana vehicle registration

^HR[\s\-]?\d{1,2}[\s\-]?[A-Z]{1,3}[\s\-]?\d{4}$

Vehicle plate registered in Haryana — starts with HR.

Punjab vehicle registration

^PB[\s\-]?\d{1,2}[\s\-]?[A-Z]{1,3}[\s\-]?\d{4}$

Vehicle plate registered in Punjab — starts with PB.

Odisha vehicle registration

^OD[\s\-]?\d{1,2}[\s\-]?[A-Z]{1,3}[\s\-]?\d{4}$

Vehicle plate registered in Odisha — starts with OD.

Assam vehicle registration

^AS[\s\-]?\d{1,2}[\s\-]?[A-Z]{1,3}[\s\-]?\d{4}$

Vehicle plate registered in Assam — starts with AS.

Himachal Pradesh vehicle registration

^HP[\s\-]?\d{1,2}[\s\-]?[A-Z]{1,3}[\s\-]?\d{4}$

Vehicle plate registered in Himachal Pradesh — starts with HP.

Uttarakhand vehicle registration

^UK[\s\-]?\d{1,2}[\s\-]?[A-Z]{1,3}[\s\-]?\d{4}$

Vehicle plate registered in Uttarakhand — starts with UK.

Jharkhand vehicle registration

^JH[\s\-]?\d{1,2}[\s\-]?[A-Z]{1,3}[\s\-]?\d{4}$

Vehicle plate registered in Jharkhand — starts with JH.

Chhattisgarh vehicle registration

^CG[\s\-]?\d{1,2}[\s\-]?[A-Z]{1,3}[\s\-]?\d{4}$

Vehicle plate registered in Chhattisgarh — starts with CG.

Bihar vehicle registration

^BR[\s\-]?\d{1,2}[\s\-]?[A-Z]{1,3}[\s\-]?\d{4}$

Vehicle plate registered in Bihar — starts with BR.

Bharat (BH) series vehicle

^\d{2}[\s\-]?BH[\s\-]?\d{4}[\s\-]?[A-Z]{2}$

New Bharat series — portable across states. Format: YY BH NNNN LL.

Electric vehicle plate (green)

^[A-Z]{2}[\s\-]?\d{1,2}[\s\-]?[A-Z]{1,3}[\s\-]?\…

EV plates have a green background — same format as regular plates.

Commercial vehicle (yellow plate)

^[A-Z]{2}[\s\-]?\d{1,2}[\s\-]?[A-Z]{1,3}[\s\-]?\…

Commercial vehicles have yellow plates — same regex as regular.

Indian state/UT 2-letter code

^(AN|AP|AR|AS|BR|CG|CH|DH|DL|DN|GA|GJ|HP|HR|JH|J…

Official 2-letter codes for all Indian states and union territories.

IEC (Importer Exporter Code)

^[A-Z0-9]{10}$

10-digit code for Indian exporters and importers.

Udyam Registration

^UDYAM-[A-Z]{2}-\d{2}-\d{7}$

MSME registration number — format UDYAM-XX-NN-NNNNNNN.

UAM (Udyog Aadhaar Memorandum)

^[A-Z]{2}\d{2}[A-Z]\d{7}$

Older 12-character MSME ID — superseded by Udyam.

PRAN (NPS account)

^\d{12}$

12-digit Permanent Retirement Account Number for NPS.

IRDAI E-IA (Insurance e-Account)

^\d{13}$

13-digit Insurance Repository account number.

ABHA (Health ID)

^\d{2}-\d{4}-\d{4}-\d{4}$

14-digit Ayushman Bharat Health Account number.

ABHA address (handle)

^[a-zA-Z0-9.\-_]{2,}@(abdm|sbx|[a-zA-Z][a-zA-Z0-…

Health handle — username@abdm or @sbx or @hdfc, etc.

Aadhaar enrollment ID (EID)

^\d{4}/\d{5}/\d{5}\s\d{2}/\d{2}/\d{4}\s\d{2}:\d{…

28-digit enrollment ID issued at Aadhaar enrollment.

EPF Member ID

^[A-Z]{2}/[A-Z]{3}/\d{7}/\d{3}/\d{7}$

Member ID format — establishment code + member number.

PUC certificate number

^[A-Z0-9]{13,15}$

Pollution Under Control certificate — 13 to 15 alphanumeric.

Drug license number

^\d{2}/\d{2}/[A-Z]{2}/\d{4}/\d{4,6}$

State drug license number — varies by state.

ISIN (Indian)

^IN[EFA9][A-Z0-9]{9}\d$

12-char International Securities ID for Indian securities (INE/IN9 prefix).

GST E-way bill

^\d{12}$

12-digit Electronic Way Bill number for goods transport.

ITR Acknowledgement number

^\d{15}$

15-digit Income Tax Return filing acknowledgement.

Trade license number

^[A-Z]{2,3}/\d{4}/\d{4,8}$

Municipal trade license — varies but commonly LL/YYYY/NNNNNN.

SBI CIF Number

^\d{11}$

11-digit Customer Information File number used by SBI.

HDFC Customer ID

^\d{8}$

8-digit customer ID used by HDFC Bank.

ICICI Customer ID

^\d{8}$

8-digit User/Customer ID for ICICI Bank.

Axis Customer ID

^\d{9}$

Customer ID for Axis Bank — typically 9 digits.

Cheque number

^\d{6}$

6-digit serial cheque number from the bottom-left of an Indian cheque.

IMPS reference number

^\d{12}$

12-digit reference number for IMPS transfers.

RTGS UTR

^[A-Z]{4}[A-Z0-9]{6}\d{12}$

22-character Unique Transaction Reference for RTGS/NEFT.

MMID (Mobile Money Identifier)

^\d{7}$

7-digit MMID used for IMPS mobile-based transfers.

Indian landline number

^(\+91[\s\-]?|0)?\d{2,4}[\s\-]?\d{6,8}$

STD code + landline — 2-4 digit STD followed by 6-8 digit number.

Toll-free 1800 number

^1800[\s\-]?\d{2,3}[\s\-]?\d{4,7}$

1800-series toll-free number — free to caller within India.

Toll-free 1860 number

^1860[\s\-]?\d{2,3}[\s\-]?\d{4,7}$

1860 toll-charged customer care numbers.

Premium-rate 1900 number

^1900[\s\-]?\d{2,3}[\s\-]?\d{4,7}$

1900-series premium-rate services (paid by caller at higher rate).

Tata Sky / Tata Play subscriber ID

^1\d{9}$

10-digit Tata Play subscriber ID (formerly Tata Sky).

Dish TV VC number

^\d{11}$

11-digit Viewing Card (VC) number for Dish TV.

Indian Railways PNR

^\d{10}$

10-digit Passenger Name Record for train bookings.

Train number

^\d{5}$

5-digit Indian Railways train number.

Railway station code

^[A-Z]{2,5}$

2-5 letter station code used by Indian Railways.

IRCTC User ID

^[a-zA-Z][a-zA-Z0-9_]{2,9}$

IRCTC username — 3-10 alphanumeric characters.

Domestic airline PNR

^[A-Z0-9]{6}$

6-character PNR used by Indian domestic airlines.

India Post tracking number

^[A-Z]{2}\d{9}IN$

13-character tracking ID for India Post articles.

Speed Post tracking

^E[EM]\d{9}IN$

India Post Speed Post — starts with EE/EM and ends IN.

Blue Dart AWB

^\d{8,11}$

Blue Dart Air Waybill — 8 to 11 digits.

DTDC tracking number

^[A-Z]{1,2}\d{8,11}$

DTDC tracking — variable but commonly 9-12 alphanumeric.

CBSE roll number

^\d{7}$

7-digit CBSE Class 10/12 roll number.

ICSE/ISC roll number

^[A-Z]\d{6}$

ICSE/ISC Council unique ID — 7 digits.

NEET roll number

^\d{12}$

12-digit NEET (medical entrance) roll number.

JEE application number

^\d{12}$

12-digit JEE Main/Advanced application number.

GATE enrollment ID

^GATE\d{9}$

13-character GATE registration number.

UPSC roll number

^\d{7}$

7-digit UPSC Civil Services examination roll number.

SSC examination roll number

^\d{11}$

11-digit SSC roll number for CGL, CHSL, MTS exams.

UGC-NET roll number

^\d{12}$

12-digit roll number for the UGC-NET (lectureship) exam.

LIC policy number

^\d{9}$

9-digit Life Insurance Corporation of India policy number.

NSDL Demat account

^IN\d{14}$

16-digit demat account number starting IN for NSDL.

CDSL Demat account

^\d{16}$

16-digit CDSL demat account — all numeric, starts with DP ID.

BSE scrip code

^\d{6}$

6-digit Bombay Stock Exchange scrip/security code.

United States 🇺🇸 6

United Kingdom 🇬🇧 5

Europe 🇪🇺 17

Other regional 31

Canadian SIN

^\d{3}[\-\s]?\d{3}[\-\s]?\d{3}$

9-digit Social Insurance Number, often formatted with spaces.

Canadian postal code

^[A-CEGHJ-NPRSTVXY]\d[A-CEGHJ-NPRSTV-Z]\s?\d[A-CEG…

Canadian postal code in A1A 1A1 format.

Australian TFN

^\d{3}\s?\d{3}\s?\d{2,3}$

8 or 9-digit Tax File Number.

Australian ABN

^\d{2}\s?\d{3}\s?\d{3}\s?\d{3}$

11-digit Australian Business Number.

Australian postcode

^\d{4}$

4-digit Australian postcode.

Brazilian CPF

^\d{3}\.\d{3}\.\d{3}-\d{2}$

Cadastro de Pessoas Físicas — Brazil individual taxpayer ID.

Brazilian CNPJ

^\d{2}\.\d{3}\.\d{3}\/\d{4}-\d{2}$

Brazilian company tax ID — 14 digits.

Brazilian CEP

^\d{5}-?\d{3}$

Brazilian postal code — 8 digits.

Chinese mobile number

^1[3-9]\d{9}$

11-digit Chinese mobile, starts with 1[3-9].

Japanese postal code

^\d{3}-\d{4}$

7-digit Japanese postal code, formatted NNN-NNNN.

Chinese citizen ID

^\d{17}[\dXx]$

18-character Chinese national ID.

Japanese My Number

^\d{12}$

12-digit Japanese personal number (Kojin Bangō).

Korean RRN

^\d{6}-[1-8]\d{6}$

13-digit Resident Registration Number, formatted with hyphen.

Singapore NRIC

^[STFGM]\d{7}[A-Z]$

Letter + 7 digits + check letter (FIN/NRIC).

Hong Kong HKID

^[A-Z]{1,2}\d{6}\([\dA]\)$

Hong Kong identity card — 1-2 letters + 6 digits + check.

Thai national ID

^\d{13}$

13-digit Thai citizen ID.

Taiwan ID number

^[A-Z][12]\d{8}$

1 letter + 9 digits, Taiwanese national ID.

Malaysia MyKad

^\d{6}-\d{2}-\d{4}$

12-digit Malaysian national ID, formatted YYMMDD-PB-NNNG.

Indonesia NIK

^\d{16}$

16-digit Indonesian national ID (Nomor Induk Kependudukan).

Vietnam CCCD

^\d{12}$

12-digit Vietnamese citizen ID (CCCD).

Japanese phone

^(\+81[\s\-]?|0)\d{1,4}[\s\-]?\d{1,4}[\s\-]?\d{3…

Japanese landline or mobile (+81).

Mexican phone (+52)

^\+52[\s\-]?1?[\s\-]?\d{2,3}[\s\-]?\d{3,4}[\s\-]…

Mexican phone with +52 country code.

Brazilian phone (+55)

^\+55[\s\-]?\(?\d{2}\)?[\s\-]?9?\d{4}[\s\-]?\d{4}$

Brazilian phone in +55 (XX) NNNNN-NNNN format.

Australian phone (+61)

^(\+61|0)[\s\-]?[2-478][\s\-]?\d{4}[\s\-]?\d{4}$

Australian phone with +61 prefix.

UAE phone (+971)

^\+971[\s\-]?\d{1,2}[\s\-]?\d{3}[\s\-]?\d{4}$

UAE phone with +971 country code.

South African phone (+27)

^(\+27|0)[\s\-]?\d{2}[\s\-]?\d{3}[\s\-]?\d{4}$

South African phone in +27 format.

Russian phone (+7)

^(\+7|8)[\s\-]?\(?\d{3}\)?[\s\-]?\d{3}[\s\-]?\d{…

Russian phone with +7 prefix.

Russian postal code

^\d{6}$

6-digit Russian postal index.

Mexican postal code

^\d{5}$

5-digit Mexican postal code.

Argentine CPA

^[A-Z]\d{4}[A-Z]{3}$

Letter + 4 digits + 3 letters (CPA Argentino).

Chinese postal code

^\d{6}$

6-digit Chinese postal code.

Contribute

Suggest a pattern

Found a regex worth sharing, or a category we're missing? Tell us about it. Form opens your email client with a structured submission.

We'll validate that it parses as a JavaScript regex before submitting.