# Passport

> Check that a Pakistani passport number has the common shape of two letters and seven digits. A format check, not DGIP verification.

Source: https://pakdatakit.dev/docs/passport/

`import { validatePassport } from 'pakdatakit/passport'`

Checks that a passport number has the common shape: two letters followed by seven digits, such as `AB1234567`. Case, surrounding spaces, and spaces or dashes between the letters and digits are ignored.

> **Treat false as unusual, not fake**
>
> DGIP does not publish the format, so this checks the common shape only. No source was found for later models (2017, 2022 e-passport) or for diplomatic and official passports, which may differ. A result of `false` means the number is unusual, not that it is fake. This is a format check, not verification with DGIP.
## Examples

**TypeScript**

```ts
import { validatePassport } from 'pakdatakit';

validatePassport('AB1234567');
// → true

validatePassport('ab 1234567');
// → true

validatePassport('A12345678');
// → false
```

**Python**

```python
from pakdatakit import validate_passport

validate_passport('AB1234567')
# → True

validate_passport('ab 1234567')
# → True

validate_passport('A12345678')
# → False
```

**Dart**

```dart
import 'package:pakdatakit/pakdatakit.dart';

validatePassport('AB1234567');
// → true

validatePassport('ab 1234567');
// → true

validatePassport('A12345678');
// → false
```

**C#**

```csharp
using PakDataKit;

Passport.Validate("AB1234567");
// → true

Passport.Validate("ab 1234567");
// → true

Passport.Validate("A12345678");
// → false
```

**PHP**

```php
use PakDataKit\Passport;

Passport::validate('AB1234567');
// → true

Passport::validate('ab 1234567');
// → true

Passport::validate('A12345678');
// → false
```

## Reference

### validatePassport()

```ts
function validatePassport(passport: string): boolean;
```

**Parameters.** `passport`: the passport number. Case, surrounding spaces and spaces or dashes between the letters and digits are ignored.

**Returns** `true` when the number is two letters followed by seven digits; otherwise `false`.

**Caveats.** Two letters and seven digits is the number format given for the 2013 ordinary passport in the EU's PRADO register, and it fits the 9-character document-number field of ICAO Doc 9303. The letters' meaning is not documented and is not checked. The MRZ check digit is not part of the number.

**Related:** [CNIC](https://pakdatakit.dev/docs/cnic/).

## Related

- [CNIC](https://pakdatakit.dev/docs/cnic/), the other identity number most forms ask for.
- [API reference for `pakdatakit/passport`](https://pakdatakit.dev/api/typescript/passport/).
