REGEXVAULTv2.0
Identity & PII/Driver's License Numbers
Verified Safe

UK DVLA Driver's License Number Regex for JavaScript

/^[A-Z9]{5}[0-9]{6}[A-Z9]{2}[A-Z0-9]{2}[A-Z]{1,2}[0-9]$/i

What this pattern does

This page provides a well-structured, multi-part regular expression for matching uk dvla driver's license number, ported and verified for JavaScript. Identity and credential patterns need both correctness and safety, since they're frequent targets for adversarial input. The snippet below is ready to drop into your JavaScript project — whether you're validating in an Express middleware, a Next.js API route, or a client-side form.

Javascript Implementation

Javascript
// UK DVLA Driver's License Number
// ReDoS-safe | RegexVault — Identity & PII > Driver's License Numbers

const ukDvlaDriversLicenseNumberRegex = /^[A-Z9]{5}[0-9]{6}[A-Z9]{2}[A-Z0-9]{2}[A-Z]{1,2}[0-9]$/i;

function validateUkDvlaDriversLicenseNumber(input: string): boolean {
  return ukDvlaDriversLicenseNumberRegex.test(input);
}

// Example
console.log(validateUkDvlaDriversLicenseNumber("SMITH691203A99AB5")); // true

Test Cases

Matches (Valid)
Rejects (Invalid)
SMITH691203A99AB5MORGA65705SM9IJ
JONES701215D99CD3morga657054sm9ij
MORGA657054SM9I
M0RGA657054SM9IJ

When to use this pattern

This pattern is drawn from the Identity & PII > Driver's License Numbers category and carries a ReDoS-safe certification. That matters for JavaScript developers because especially critical in long-running Node.js event loops where a ReDoS vulnerability can block the entire process. RegexVault audits patterns against known backtracking attack vectors, ensuring you have the necessary context before using this regex in a high-stakes production environment.

Common Pitfalls

UK driving licence numbers encode personal data by design. A change of name (e.g., after marriage) requires a new licence with a new number. The encoded gender is binary — the DVLA is updating this for non-binary licence holders.

Technical Notes

UK DL structure: surname (first 5 chars, padded with 9), birth decade digit + DOB (MDDYM where M is month, padded for females with 5 added to month), initials + suffix digits. Encodes surname, DOB, and gender — extremely information-dense PII.

Have a pattern that belongs in the vault?

Submit it for review — community-verified patterns get credited to your GitHub handle. Free submissions join the queue. Priority review available for $15.

Submit a Pattern