Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
PCRE2 (PHP >=7.3)

/
[A|D|M|T][0-9]{8}
/
gm

Description

South African Passport Number Regex

Passport number consists of a letter, followed by 8 digits.

The letter at the beginning of the passport number is either A (Normal passport holders), M (Maxi passport holders), D (Diplomatic passport holders) or T (Travel passport holders, I cannot confirm this, but I think this passport type have fazed out since 2009 when the passports have been revamped).

Submitted by Riaan van den Berg - 2 years ago