validate

Validates an Indian Permanent Account Number (PAN).

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:

Note: Hyphens are not stripped. "ABCPE-1234F" normalises to 11 characters and returns InvalidReason.WRONG_LENGTH.

Return

ValidationResult.Valid if the PAN passes format and category validation, ValidationResult.Invalid with an appropriate InvalidReason otherwise.

Parameters

value

Raw PAN string in any common input form.

Samples

check(PAN.validate("ABCPE1234F") == ValidationResult.Valid)
check(PAN.validate("ABCZE1234F") is ValidationResult.Invalid)