34

Well I have been asked to validate passport numbers (the documents used on airports to travel to other countries).

My question is: What format are these "numbers"? All I know is that they can have letters but I am not finding any place defining the rules. Any pointers/Links?

James Moore
  • 2,501
  • 6
  • 26
  • 29
Sergio
  • 8,125
  • 10
  • 46
  • 77

2 Answers2

32

I don't think you're going to be able to do this without restricting yourself to certain issuing countries. If you look at the specs of machine readable passports:

http://www.highprogrammer.com/alan/numbers/mrp.html

It says that each country is free to use any format it likes for the actual passport number (including letters or digits). Although in the machine readable schema these seem to be limited to 9 characters (which might cause problems for countries with billions of citizens if they were to just use digits!)

UpTheCreek
  • 31,444
  • 34
  • 152
  • 221
  • 2
    What you are saying is right, but those passports that I saw until now, all consist of one alphabet and 8 digits (9 in total) which caters for about 2.6 billion population. On the other hand China (biggest population) uses passport numbers consist of 9 numbers. may be because they don't expect every Chinese travel the world? – AaA Oct 29 '13 at 02:41
7

I would expect the format to depend on the issuing country.

UK passport numbers consist of 9 digits but used to consist of 6 digits and a letter.

dave4420
  • 46,404
  • 6
  • 118
  • 152