Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
PCRE (PHP <7.3)

/
(?<type>[A-Z]{1})(?<subtype>[A-Z<]{1})(?<issue_country>[A-Z]{3})(?<doc_number>[A-Z0-9<]{9})(?<check_sum>[0-9]{1})(?<first_optional>[A-Z0-9<]{15})\n(?<date_brith>[0-9]{6})(?<birth_check>[0-9{1}])(?<sex>[MF]{1})(?<expiration_date>[0-9]{6})(?<expiration_check>[0-9]{1})(?<nationality>[A-Z]{3})(?<second_optional>[A-Z0-9<]{11})(?<check_digit>[0-9]{1})\n(?<lname>[A-Z]+)(?<lname2><[A-Z]+){0,}<<(?<spacing>[<]{0,})(?<fname>[A-Z]+)(?<mname1><[A-Z]+){0,}(?<complement><.+){0,}
/
g

Description

Machine readable pattern to validate ID card informations

Submitted by Igor Ferreira - 8 years ago