lanka-validations - v2.1.0
    Preparing search index...

    Function parseVehiclePlate

    • Parses any Sri Lankan vehicle registration number plate.

      Supports:

      • Modern English Series: 'WP CAB-1234', 'CAB-1234', 'WP BZ-9999'
      • Modern Numeric Series: 'WP 123-4567', '300-1234'
      • 'Sri' Series: '14 Sri 1234', '14 ශ්‍රී 1234'
      • Vintage Series: 'EY 1234', 'Z 1234'

      Parameters

      • rawPlate: unknown

        Vehicle plate in any common spacing. Strings and finite numbers are accepted; other types return a failure without throwing.

      Returns VehiclePlateInfo | null

      Era, province, series, number, and a formatted version, or null if invalid.

      parseVehiclePlate('WP CAB-1234')?.provinceName; // 'Western Province'
      parseVehiclePlate('14 Sri 1234')?.era; // 'sri_series'