Comment: Second Line capturing group
Group PassportNumber(?<PassportNumber>[A-Z0-9<]{9}) Character Class[A-Z0-9<]{9} {9}matches exactly 9 characters from the set below:
A-Zone character from A (6510) to Z (9010) (case sensitive)
0-9one character from 0 (4810) to 9 (5710)
<the literal < (6010 / 748 / 3C16)
Comment: Passport number, length 9, padded with <
Group CheckDigit19(?<CheckDigit19>[0-9]{1}) {1}matches one character from the set below:
0-9one character from 0 (4810) to 9 (5710)
Comment: Check digit for position 1 to 9
Group Nationality(?<Nationality>\g{IssuingCountry}) \g{IssuingCountry}the text saved by group IssuingCountry
Comment: Nationality, follows the same rule as match group 4
Group DoB(?<DoB> # Date Of Birth
(?<DoBYear>[0-9]{2})
(?<DoBMonth>(?:0[1-9]|1[0-2]))
(?<DoBDay>(?:0[1-9]|(?:1|2)[0-9]|3[01]))
) Comment: Date Of Birth
Group DoBYear(?<DoBYear>[0-9]{2}) {2}matches exactly 2 characters from the set below:
0-9one character from 0 (4810) to 9 (5710)
Group DoBMonth(?<DoBMonth>(?:0[1-9]|1[0-2])) Non-Capturing Group(?:0[1-9]|1[0-2]) 0the literal 0 (4810 / 608 / 3016)
1-9one character from 1 (4910) to 9 (5710)
Group DoBDay(?<DoBDay>(?:0[1-9]|(?:1|2)[0-9]|3[01])) Group CheckDigit1419(?<CheckDigit1419>[0-9]) Comment: Check digit for position 14 to 19
Comment: Sex (Male, Female or not defined)
Group Expiral(?<Expiral> # Expiral date
(?<ExpiralYear>[0-9]{2}) # W
(?<ExpiralMonth>(?:0[1-9]|1[0-2]))
(?<ExpiralDay>(?:0[1-9]|(?:1|2)[0-9]|3[01]))
) Group CheckDigit2227(?<CheckDigit2227>[0-9]) Comment: Check digit for position 22 to 27
Group PersonalNumber(?<PersonalNumber>[A-Z0-9<]{14}) Comment: Personal number padded with <
Group CheckDigit2942(?<CheckDigit2942>[0-9<]) Comment: Check digit for position 29 to 42 (can be < empty)
Group CheckDigitF(?<CheckDigitF>[0-9]) Comment: Check digit