New blogMaking an AI Agent You Can Trust With Money

★ India · regex

Regex for Indian Vehicle Number

Standard plates are a state or UT code, a 1–2 digit RTO number (Delhi adds a category letter, as in DL 3C), up to three series letters and four digits. Bharat-series plates are the registration year, BH, four digits and one or two letters.

  • Runs in your browser
  • No signup

Try the indian vehicle number pattern

Read it in plain English (best-effort)

  • ^start of a line
  • (?:start a group (not captured)
  • (?:start a group (not captured)
  • ANthe text 'AN'
  • |or
  • APthe text 'AP'
  • |or
  • ARthe text 'AR'
  • |or
  • ASthe text 'AS'
  • |or
  • BRthe text 'BR'
  • |or
  • CGthe text 'CG'
  • |or
  • CHthe text 'CH'
  • |or
  • DDthe text 'DD'
  • |or
  • DLthe text 'DL'
  • |or
  • DNthe text 'DN'
  • |or
  • GAthe text 'GA'
  • |or
  • GJthe text 'GJ'
  • |or
  • HPthe text 'HP'
  • |or
  • HRthe text 'HR'
  • |or
  • JHthe text 'JH'
  • |or
  • JKthe text 'JK'
  • |or
  • KAthe text 'KA'
  • |or
  • KLthe text 'KL'
  • |or
  • LAthe text 'LA'
  • |or
  • LDthe text 'LD'
  • |or
  • MHthe text 'MH'
  • |or
  • MLthe text 'ML'
  • |or
  • MNthe text 'MN'
  • |or
  • MPthe text 'MP'
  • |or
  • MZthe text 'MZ'
  • |or
  • NLthe text 'NL'
  • |or
  • ODthe text 'OD'
  • |or
  • ORthe text 'OR'
  • |or
  • PBthe text 'PB'
  • +49 more

One sample per line works well with the m flag on anchored patterns.

Waiting for a pattern
01

The pattern, piece by piece

/^(?:(?:AN|AP|AR|AS|BR|CG|CH|DD|DL|DN|GA|GJ|HP|HR|JH|JK|KA|KL|LA|LD|MH|ML|MN|MP|MZ|NL|OD|OR|PB|PY|RJ|SK|TN|TR|TS|UK|UP|WB)[ -]?[0-9]{1,2}[A-Z]?[ -]?[A-Z]{0,3}[ -]?[0-9]{4}|[0-9]{2}[ -]?BH[ -]?[0-9]{4}[ -]?[A-Z]{1,2})$/
Pattern explanation
PartWhat it does
(?:AN|AP|…|WB)a valid state or union territory code
[0-9]{1,2}[A-Z]?RTO number, with an optional category letter (Delhi)
[A-Z]{0,3}series letters
[0-9]{4}the four-digit number
|[0-9]{2}[ -]?BH[ -]?[0-9]{4}[ -]?[A-Z]{1,2}or a Bharat-series plate: year, BH, number, letters
02

What it accepts and rejects

Every sample below is checked automatically in JavaScript and Python. The tester above is preloaded with all of them, one per line.

Should match
Should match
MH12AB1234✓
MH 12 AB 1234✓
DL 3C AB 1234✓
KA-01-MJ-2023✓
TN 09 BX 0001✓
22 BH 1234 AA✓
Should not match
Should not match
XX 12 AB 1234✗
MH 123 AB 1234✗
MH 12 ABCD 1234✗
MH12AB123✗
22 BH 123 AA✗
mh12ab1234✗
03

Copy it into your code

RE2-safeNo lookarounds or backreferences, so the same pattern works in Go's RE2 engine and in Rust's regex crate.

const indianVehicleNumberRe = /^(?:(?:AN|AP|AR|AS|BR|CG|CH|DD|DL|DN|GA|GJ|HP|HR|JH|JK|KA|KL|LA|LD|MH|ML|MN|MP|MZ|NL|OD|OR|PB|PY|RJ|SK|TN|TR|TS|UK|UP|WB)[ -]?[0-9]{1,2}[A-Z]?[ -]?[A-Z]{0,3}[ -]?[0-9]{4}|[0-9]{2}[ -]?BH[ -]?[0-9]{4}[ -]?[A-Z]{1,2})$/;

export function isValidIndianVehicleNumber(value) {
  return indianVehicleNumberRe.test(value.trim());
}
04

When not to use regex for this

To check a registration is real and fetch vehicle details, use the government's VAHAN/Parivahan services. Uppercase and strip separators before storing.

05

Questions engineers actually ask

What is a BH (Bharat) series number?
A national registration introduced in 2021 for eligible employees who move between states. It starts with the year of registration, then BH.
Why is the list of state codes hard-coded?
So that random two-letter prefixes like XX don't pass. Update the list if codes change.
What is catastrophic backtracking?
Some patterns, usually nested quantifiers like (a+)+, make a backtracking engine try an exponential number of paths on input that almost matches. The tester stops any run after 300ms, so a bad pattern can't freeze your tab. In production, that same pattern can take down a server (a ReDoS attack).
06

Sources

Formats were checked on 8 November 2026. Rules change; the official issuer wins if it disagrees.

07

More india patterns

08

More from the workbench

Fine print

Tools: on the house.
Engineer: by the hour.

The regex was free. Code that doesn't need one is the upgrade: typed schemas, validated once at the edge, trusted everywhere after.

I'm Himanshu, an AI and full-stack engineer. I build MVPs, AI agents and the growth plumbing around them for early-stage startups.