Regex Library
Regex Library

16 patterns

Identification Regex Patterns

Identification patterns for validating unique identifiers used across different systems and countries. From standard UUIDs in software systems to book ISBNs and national ID formats.

Common Use Cases

Database ID validationDocument scanningLibrary systemsIdentity verification

All Identification Patterns

US Social Security Number

Validates the US SSN format (9 digits with hyphens).

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

AWS ARN

Validates Amazon Web Services Resource Name format

^arn:aws:[a-z0-9-]+:[a-z0-9-]*:[0-9]{12}:[a-zA-Z0-9/_-]+$

Google Analytics ID

Validates Google Analytics tracking IDs (Universal and GA4)

^(UA|G)-[0-9A-Z]+-[0-9]+$

UUID v4

Validates a UUID version 4 (randomly generated identifier).

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

ISBN-13

Validates ISBN-13 book identifiers with optional hyphens or spaces.

^97[89][- ]?(?:\d[- ]?){9}\d$

EAN-13 Barcode

Validates EAN-13 product barcodes (13 digits).

^[0-9]{13}$

NanoID

Validates default NanoID identifiers (21 URL-safe characters).

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

ULID

Validates Universally Unique Lexicographically Sortable Identifiers.

^[0-9A-HJKMNP-TV-Z]{26}$

Vehicle Identification Number (VIN)

Validates a 17-character VIN (Vehicle Identification Number). Excludes letters I, O, Q to avoid digit confusion.

^[A-HJ-NPR-Z0-9]{17}$

ISBN-10

Validates a 10-character ISBN. Last position can be X (representing 10 in mod-11 checksum).

^(?:\d{9}X|\d{10})$

Brazil CPF

Validates the Brazilian CPF (Cadastro de Pessoas Físicas) formatted as 000.000.000-00.

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

Brazil CNPJ

Validates the Brazilian CNPJ (Cadastro Nacional da Pessoa Jurídica) formatted as 00.000.000/0000-00.

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

Spain DNI / NIE

Validates Spanish DNI (8 digits + letter) and NIE (X/Y/Z + 7 digits + letter) identifiers.

^([0-9]{8}|[XYZ][0-9]{7})[A-Z]$

DOI (Digital Object Identifier)

Validates an academic DOI (10.xxxx/yyyy). Case-insensitive flag recommended.

^10\.\d{4,9}\/[-._;()\/:A-Z0-9]+$

ORCID Researcher ID

Validates an ORCID identifier (4×4 digit groups, last digit can be X for checksum 10).

^\d{4}-\d{4}-\d{4}-\d{3}[\dX]$

US EIN (Employer Identification Number)

Validates a US Employer Identification Number (xx-xxxxxxx).

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

Frequently Asked Questions

What is the difference between UUID v4 and v1?

v1 is time-based (contains timestamp and MAC address). v4 is randomly generated. v4 is more common in modern apps for privacy reasons.

How do I generate a UUID in JavaScript?

Use crypto.randomUUID() in modern browsers/Node.js, or the uuid npm package for broader compatibility.

How do I validate an ISBN-13?

Use the ISBN-13 pattern which accepts both plain (9780306406157) and formatted (978-0-306-40615-7) versions.

Looking for patterns in other categories?

Browse all 209 patterns