validate
Validates an Indian vehicle registration number (RC).
Input normalisation applied before validation (in order):
Trim leading/trailing whitespace
Strip all internal whitespace (covers space-separated plate forms)
Strip all hyphens (covers hyphen-separated plate forms common in printed documents)
Uppercase all characters
After normalisation, checks are applied in order — first failing check wins:
InvalidReason.EMPTY if the result is blank
InvalidReason.WRONG_LENGTH if length is not in 8..11
InvalidReason.INVALID_FORMAT if string does not match
^[A-Z]{2}[0-9]{1,2}[A-Z]{1,3}[0-9]{4}$InvalidReason.INVALID_PREFIX if the first two characters are not in the closed set of 38 MoRTH-assigned state/UT codes (see VALID_STATE_CODES)
Never throws. Returns ValidationResult.Invalid for all invalid inputs.
Return
ValidationResult.Valid if the registration is valid, ValidationResult.Invalid with an appropriate InvalidReason otherwise.
Parameters
Raw vehicle registration string in any common input form.
Samples
check(VehicleRC.validate("MH01AB1234") == ValidationResult.Valid)