validate

Validates an Indian Passport number.

Input normalisation applied before validation (in order):

  1. Trim leading/trailing whitespace

  2. Strip all internal whitespace (covers copy-paste with spaces)

  3. Uppercase all characters

After normalisation, checks are applied in order — first failing check wins:

No checksum: MEA has not published a public checksum algorithm for Indian passport numbers. Validation is structural only.

Note: Hyphens are not stripped. "M-1234567" normalises to 9 characters and returns InvalidReason.WRONG_LENGTH.

Return

ValidationResult.Valid if the Passport number passes format validation, ValidationResult.Invalid with an appropriate InvalidReason otherwise.

Parameters

value

Raw Passport number string in any common input form.

Samples

check(Passport.validate("A1234567") == ValidationResult.Valid)