Regex for Indian vehicle registration number
Standard Indian number plates follow the layout state code, RTO number, series letters, and a four-digit number, for example RJ14 AB 1234. People write them with spaces, dashes, or no separators, and this pattern accepts all three.
The pattern
/\b[A-Z]{2}[ -]?\d{1,2}[ -]?[A-Z]{1,3}[ -]?\d{4}\b/gThe tester opens with this pattern and the examples below already loaded. Nothing you type is uploaded.
How it works
[A-Z]{2}- State or union territory code, such as RJ, MH or DL.
\d{1,2}- RTO district number, one or two digits.
[A-Z]{1,3}- Series letters, one to three.
\d{4}- Four-digit registration number.
[ -]?- Optional space or dash between each part.
Examples
Matches
RJ14 AB 1234MH-12-AB-1234DL1CAB1234KA01MH0001
Does not match
1234 AB 5678RJ14 1234rj14ab1234
Use it in JavaScript
const re = /\b[A-Z]{2}[ -]?\d{1,2}[ -]?[A-Z]{1,3}[ -]?\d{4}\b/g;
// Find every match in a block of text
const found = text.match(re);
// Validate that a whole value matches (no stray characters around it)
const exact = new RegExp('^(?:' + re.source + ')$', re.flags.replace('g', ''));
const isValid = exact.test(value);Limits and tips
- Bharat (BH) series plates use a different layout: two digits for the year, BH, four digits and two letters. A separate pattern such as \b\d{2}BH\d{4}[A-Z]{2}\b matches them.
- The pattern does not check that the state code or RTO number exists.
Frequently asked questions
What is the format of an Indian number plate?
State code, RTO number, series letters and a four-digit number, for example RJ14 AB 1234.
Does it match plates written without spaces?
Yes. The separators are optional, so DL1CAB1234 matches too.