validate

Validates an Indian Tax Deduction Account Number (TAN).

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:

The regex encodes all structural constraints simultaneously:

  • Characters 1–4 must be [A-Z]

  • Characters 5–9 must be [0-9]

  • Character 10 must be [A-Z]

Note: Hyphens and other special characters are not stripped. "MUMD-2345A" normalises to a 10-character string but fails regex and returns InvalidReason.INVALID_FORMAT.

Return

ValidationResult.Valid if the code is a valid TAN, ValidationResult.Invalid with an appropriate InvalidReason otherwise.

Parameters

value

Raw TAN string in any common input form.

Samples

check(TAN.validate("PDES03028F") == ValidationResult.Valid)