Regex to Match US Passport Numbers

Validate US passport numbers with this regex pattern. Matches one uppercase letter followed by eight digits. Free online regex tool.

Regular Expression

/^[A-Z]\d{8}$/

Token Breakdown

TokenDescription
^Anchors at the start of the string (or line in multiline mode)
[A-Z]Character class — matches any one of: A-Z
\dMatches any digit (0-9)
{8}Matches exactly 8 times
$Anchors at the end of the string (or line in multiline mode)

Detailed Explanation

This regex validates US passport numbers, which consist of one uppercase letter followed by eight digits. Here is the token-by-token breakdown:

^ — Anchors the match at the start of the string. This ensures no characters precede the passport number.

[A-Z] — A character class matching a single uppercase letter from A to Z. US passport numbers begin with one letter that indicates the passport book type or series. This class is case-sensitive (no i flag), so only uppercase letters are accepted, matching how passport numbers are officially printed.

\d{8} — Matches exactly eight digits. The \d shorthand is equivalent to [0-9], and the {8} quantifier requires precisely eight occurrences. Together with the leading letter, this creates the standard nine-character US passport number format.

$ — Anchors the match at the end of the string, ensuring no trailing characters.

US passport numbers follow a simple alphanumeric format: one letter followed by eight digits, for a total of nine characters. Examples include A12345678 and C00112233. This pattern performs format validation only and does not check whether the passport number has actually been issued or is currently valid. Different countries have different passport number formats. For example, UK passports use nine digits without a letter prefix, and Canadian passports have two letters followed by six digits. If you need to validate passports from multiple countries, you would need separate patterns or a more complex alternation.

Example Test Strings

InputExpected
A12345678Match
C00112233Match
a12345678No Match
AB1234567No Match
123456789No Match

Try It — Interactive Tester

//
gimsuy
No matches found.
Pattern: 12 charsFlags: noneMatches: 0

Ctrl+Shift+C to copy regex

Customize this pattern →