Vehicle RC
Validator and formatter for Indian vehicle registration numbers (RC — Registration Certificate).
Vehicle registration numbers are issued by state RTOs under MoRTH (Ministry of Road Transport and Highways). Every vehicle registered in India receives an RC number that appears on its licence plate, insurance policy, fitness certificate, toll records, and e-challan.
Format: [A-Z]{2}\d{1,2}[A-Z]{1,3}\d{4} — total 8–11 characters after normalization:
Characters 1–2: state/UT code (e.g.
MH,KA,DL) — validated against a closed set of 38 MoRTH-assigned codes (see VALID_STATE_CODES)Characters 3–4 (or 3): district code (1–2 digits, assigned by the district RTO)
Next 1–3 characters: series code (uppercase letters)
Last 4 characters: unique registration number (4 digits)
Accepted input forms (all normalised before validation):
Raw uppercase:
"MH12AB1234"— canonical formLowercase:
"mh12ab1234"— normalised to uppercaseWith spaces:
"MH 12 AB 1234"— internal whitespace strippedWith hyphens:
"MH-12-AB-1234"— hyphens stripped (common in printed documents)Mixed:
"mh-12-ab-1234"— normalisedPadded:
" MH12AB1234 "— leading/trailing whitespace trimmed
No mask() method: Vehicle registration numbers appear on physical licence plates that are publicly visible on roads and in public databases. Per KotIndia PII policy (§3.5, Public/semi-public category), no masking is provided or needed.
State codes — 38 entries: All active MoRTH-issued state/UT vehicle prefixes, plus two legacy codes still present on physical plates for vehicles registered before code changes:
OD— Odisha (current, post-2011)OR— Odisha legacy (pre-2011 plates still legally on roads; aligned with DL Slice 10d, Marcus arch review fb_20260503_020005_f0a329)DD— Daman & Diu legacy (merged into DN in 2020; older physical plates still active)UTexcluded — not a canonically MoRTH-issued vehicle prefix; active Uttarakhand code isUK
Source: MoRTH vehicle registration code list, cross-referenced with public Vahan4 data (https://vahan.parivahan.gov.in/) and DL Slice 10d state code alignment.
This object is stateless and thread-safe.
Samples
VehicleRC.validate("MH01AB1234") // ValidationResult.Valid
VehicleRC.format("mh01ab1234") // "MH01AB1234"