Regular Expressions 101

Library entries

Machine Readable Passport - Extractor

Vote

1

Regular Expression
pcre

/
^(?<FirstLine>(?<Passport>P)(?<PassportType>.)(?<IssuingCountry>\w{3})(?<PassportOwner>(?<Surname>\w+)<<(?<GivenName>(?:[\w]+<?)+)[<]+))\n(?<SecondLine>(?<PassportNumber>[a-zA-Z0-9<]{9})(?<CheckDigit19>[0-9]{1})(?<Nationality>[A-Za-z]{3})(?<DoB>[0-9]{6})(?<CheckDigit1419>[0-9])(?<Sex>[MF<])(?<Expiral>[0-9]{6})(?<CheckDigit2227>[0-9])(?<PersonalNumber>[\w<]{14})(?<CheckDigit2942>[0-9<])(?<CheckDigitF>[0-9]))$
/
m

Description

Loading markdown...
Submitted by Mauro - 6 years ago