A form that accepts vehicle numbers gets every variant imaginable: dl 3c ab 1234, HR-26-DK-8337, up16bt0001, 22 BH 4567 AA. Here's a small, dependency-free way to normalise and validate them, plus the cases that trip up the regex most people copy from the first search result.
The two formats
Standard plates follow: state code (2 letters) + RTO district code (1–2 digits) + series (0–3 letters) + number (1–4 digits). Delhi is the odd one out because it adds a category letter after the RTO number, as in DL 3C AB 1234, but the general pattern still covers it.
Bharat (BH) series plates, introduced in 2021, look different: the year of first registration (2 digits) + BH + 4 digits + 2 letters, as in 22 BH 4567 AA.
The code
function normalisePlate(input) { return String(input).toUpperCase().replace(/[\s.\-]/g, ''); } const STANDARD = /^([A-Z]{2})(\d{1,2})([A-Z]{0,3})(\d{1,4})$/; const BH = /^(\d{2})BH(\d{4})([A-Z]{2})$/; function parsePlate(input) { const plate = normalisePlate(input); let m = plate.match(BH); if (m) return { type: 'BH', year: 2000 + Number(m[1]), number: m[2], series: m[3] }; m = plate.match(STANDARD); if (m) return { type: 'STANDARD', state: m[1], rto: m[2], series: m[3], number: m[4] }; return null; } ['dl 3c ab 1234', 'HR-26-DK-8337', 'up16bt0001', '22 BH 4567 AA', 'DL3CAB12345'] .forEach(p => console.log(p, '→', parsePlate(p))); The BH check runs first, because a BH plate starts with digits and would otherwise just fail the standard pattern with no useful message.
Gotchas
- Validate the state code. The regex accepts
ZZ. A real validator should check against the list of state and UT codes. - Don't strip leading zeros.
0001and1are the same number on paper, but users search by what's printed on the plate. - Format is not existence. A valid-looking string can still be a number that was never issued. The registration record lives with the RTO, so for anything that matters, such as a purchase, you need an actual RC lookup by registration number.
- BH plates carry extra meaning. The first two digits give the registration year, which is handy for a quick age check. On the buying side there are also eligibility rules, covered in this guide to buying a used BH-series car.
I work on Hooter, a used-car marketplace in Delhi NCR, where plate input is one of the messiest fields we handle.

