Skip to content

Instantly share code, notes, and snippets.

@iamNarcisse
Created December 22, 2023 07:11
Show Gist options
  • Save iamNarcisse/be4477e4f102dc23c985ebc70f71f5f1 to your computer and use it in GitHub Desktop.
Save iamNarcisse/be4477e4f102dc23c985ebc70f71f5f1 to your computer and use it in GitHub Desktop.
Country Passport Regex
[
{
"regex": "^[A-Z]{3}\\d{6}$",
"name": "Argentina",
"iso2": "AR",
"iso3": "ARG"
},
{
"regex": "^\\d{9}$",
"name": "Angola",
"iso2": "AO",
"iso3": "AGO"
},
{
"regex": "^[A-Z]{2}\\d{7}$",
"name": "Armenia",
"iso2": "AM",
"iso3": "ARM"
},
{
"regex": "^[A-Z]{1}\\d{7}$",
"name": "Nauru",
"iso2": "NR",
"iso3": "NRU"
},
{
"regex": "^[A-Z0-9]{2}\\d{7}$",
"name": "Italy",
"iso2": "IT",
"iso3": "ITA"
},
{
"regex": "^\\d{9}$",
"name": "Mali",
"iso2": "ML",
"iso3": "MLI"
},
{
"regex": "^[A-Z]\\d{7}$",
"name": "Australia",
"iso2": "AU",
"iso3": "AUS"
},
{
"regex": "^\\d{8}$",
"name": "Uganda",
"iso2": "UG",
"iso3": "UGA"
},
{
"regex": "^[A-Z]\\d{7}$",
"name": "Austria",
"iso2": "AT",
"iso3": "AUT"
},
{
"regex": "^[A-Z0-9]{6}$",
"name": "Andorra",
"iso2": "AD",
"iso3": "AND"
},
{
"regex": "^[A-Z]{2}\\d{7}$",
"name": "Afghanistan",
"iso2": "AF",
"iso3": "AFG"
},
{
"regex": "^[A-Z]{2}\\d{7}$",
"name": "Albania",
"iso2": "AL",
"iso3": "ALB"
},
{
"regex": "^[A-Z]{2}\\d{6}$",
"name": "Algeria",
"iso2": "DZ",
"iso3": "DZA"
},
{
"regex": "^[A-Z]{2}\\d{6}$ ",
"name": "American Samoa",
"iso2": "AS",
"iso3": "ASM"
},
{
"regex": "^[A-Z]{2,3}\\d{7,8}$",
"name": "Azerbaijan",
"iso2": "AZ",
"iso3": "AZE"
},
{
"regex": "^[A-Z]{1,2}\\d{7}$",
"name": "Bahrain",
"iso2": "BH",
"iso3": "BHR"
},
{
"regex": "^[A-Z]{2}\\d{7}$",
"name": "Bangladesh",
"iso2": "BD",
"iso3": "BGD"
},
{
"regex": "^[A-Z]{2}\\d{7}$",
"name": "Belarus",
"iso2": "BY",
"iso3": "BLR"
},
{
"regex": "^\\d{7}$",
"name": "Bhutan",
"iso2": "BT",
"iso3": "BTN"
},
{
"regex": "^[A-Z]{2}\\d{6}[A-Z]$",
"name": "Bolivia",
"iso2": "BO",
"iso3": "BOL"
},
{
"regex": "^[A-Z]{2}\\d{7}$",
"name": "Botswana",
"iso2": "BW",
"iso3": "BWA"
},
{
"regex": "^\\d{9}$",
"name": "Bulgaria",
"iso2": "BG",
"iso3": "BGR"
},
{
"regex": "^[A-Z]{2}\\d{7}$",
"name": "Burkina Faso",
"iso2": "BF",
"iso3": "BFA"
},
{
"regex": "^[A-Z]{1}\\d{7}$",
"name": "Cambodia",
"iso2": "KH",
"iso3": "KHM"
},
{
"regex": "^[A-Z]{2}\\d{7}$",
"name": "Cameroon",
"iso2": "CM",
"iso3": "CMR"
},
{
"regex": "^[A-Z]{2}\\d{6}$",
"name": "Canada",
"iso2": "CA",
"iso3": "CAN"
},
{
"regex": "^[A-Z]{2}\\d{6}$",
"name": "Cape Verde",
"iso2": "CV",
"iso3": "CPV"
},
{
"regex": "^[A-Z]{1}\\d{8}$",
"name": "Central African Republic",
"iso2": "CF",
"iso3": "CAF"
},
{
"regex": "^[A-Z]{2}\\d{9}$",
"name": "Chad",
"iso2": "TD",
"iso3": "TCD"
},
{
"regex": "^[A-Z]{2}\\d{6}$",
"name": "Colombia",
"iso2": "CO",
"iso3": "COL"
},
{
"regex": "^\\d{6}$",
"name": "Cook Islands",
"iso2": "CK",
"iso3": "COK"
},
{
"regex": "^[A-Z]{3}\\d{6}$",
"name": "Costa Rica",
"iso2": "CR",
"iso3": "CRI"
},
{
"regex": "^\\d{9}$",
"name": "Croatia",
"iso2": "HR",
"iso3": "HRV"
},
{
"regex": "^[A-Z]{2}\\d{6}$",
"name": "Cuba",
"iso2": "CU",
"iso3": "CUB"
},
{
"regex": "^\\d{9}$",
"name": "Denmark",
"iso2": "DK",
"iso3": "DNK"
},
{
"regex": "^[A-Z]{2}\\d{5}$",
"name": "Dominica",
"iso2": "DM",
"iso3": "DMA"
},
{
"regex": "^\\d{6}[A-Z]{1}\\d{2}$",
"name": "Dominican Republic",
"iso2": "DO",
"iso3": "DOM"
},
{
"regex": "^[A-Z]{2}\\d{6}$",
"name": "Ecuador",
"iso2": "EC",
"iso3": "ECU"
},
{
"regex": "^([A-Z]\\d{7}|[A-Z]{2}\\d{7})$",
"name": "Estonia",
"iso2": "EE",
"iso3": "EST"
},
{
"regex": "^\\d{8}$",
"name": "Ethiopia",
"iso2": "ET",
"iso3": "ETH"
},
{
"regex": "^\\d{8}$",
"name": "El Salvador",
"iso2": "SV",
"iso3": "SLV"
},
{
"regex": "^[A-Z]{2}\\d{7}$",
"name": "Finland",
"iso2": "FI",
"iso3": "FIN"
},
{
"regex": "^\\d{2}[A-Z]{2}\\d{5}$",
"name": "France",
"iso2": "FR",
"iso3": "FRA"
},
{
"regex": "^\\d{9}$",
"name": "Gabon",
"iso2": "GA",
"iso3": "GAB"
},
{
"regex": "^\\d{9}$",
"name": "Georgia",
"iso2": "GE",
"iso3": "GEO"
},
{
"regex": "^[A-Z0-9]{2}\\d{7}$",
"name": "Ireland",
"iso2": "IE",
"iso3": "IRL"
},
{
"regex": "^[CFGHJKLMNPRTVWXYZ0-9]{9}$",
"name": "Germany",
"iso2": "DE",
"iso3": "DEU"
},
{
"regex": "^[A-Z]{2}\\d{6}$",
"name": "Ghana",
"iso2": "GH",
"iso3": "GHA"
},
{
"regex": "^\\d{9}$",
"name": "Greenland",
"iso2": "GL",
"iso3": "GRL"
},
{
"regex": "^[A-Z]{2}\\d{6}$",
"name": "Guatemala",
"iso2": "GT",
"iso3": "GTM"
},
{
"regex": "^\\d{6}$",
"name": "Guyana",
"iso2": "GY",
"iso3": "GUY"
},
{
"regex": "^\\d{2}\\s\\d{2}\\s\\d{4}$",
"name": "Haiti",
"iso2": "HT",
"iso3": "HTI"
},
{
"regex": "^[A-Z]{1}\\d{7}$",
"name": "Honduras",
"iso2": "HN",
"iso3": "HND"
},
{
"regex": "^[A-Z]{2}(\\d{6}|\\d{7})$",
"name": "Hungary",
"iso2": "HU",
"iso3": "HUN"
},
{
"regex": "^[A-Z]{1}-?\\d{7}$",
"name": "India",
"iso2": "IN",
"iso3": "IND"
},
{
"regex": "^[A-C]\\d{7}$",
"name": "Indonesia",
"iso2": "ID",
"iso3": "IDN"
},
{
"regex": "^\\d{9}$",
"name": "Iraq",
"iso2": "IQ",
"iso3": "IRQ"
},
{
"regex": "^(A)\\d{7}$",
"name": "Iceland",
"iso2": "IS",
"iso3": "ISL"
},
{
"regex": "^\\d{8}$",
"name": "Israel",
"iso2": "IL",
"iso3": "ISR"
},
{
"regex": "^[Aa]\\d{7}$",
"name": "Jamaica",
"iso2": "JM",
"iso3": "JAM"
},
{
"regex": "^[A-Z]{2}\\d{7}$",
"name": "Japan",
"iso2": "JP",
"iso3": "JPN"
},
{
"regex": "^\\d{8}$",
"name": "Jordan",
"iso2": "JO",
"iso3": "JOR"
},
{
"regex": "^[a-zA-Z]\\d{7}$",
"name": "Kazakhstan",
"iso2": "KZ",
"iso3": "KAZ"
},
{
"regex": "^\\d{8}$",
"name": "Kenya",
"iso2": "KE",
"iso3": "KEN"
},
{
"regex": "^\\d{8}$",
"name": "Kiribati",
"iso2": "KI",
"iso3": "KIR"
},
{
"regex": "^\\d{8}$",
"name": "Kuwait",
"iso2": "KW",
"iso3": "KWT"
},
{
"regex": "^[A-Z]{2}\\d{7}$",
"name": "Kyrgyzstan",
"iso2": "KG",
"iso3": "KGZ"
},
{
"regex": "^\\d{8}$",
"name": "Laos",
"iso2": "LA",
"iso3": "LAO"
},
{
"regex": "^[A-Z0-9]{2}\\d{7}$",
"name": "Latvia",
"iso2": "LV",
"iso3": "LVA"
},
{
"regex": "^\\d{8}$",
"name": "Lebanon",
"iso2": "LB",
"iso3": "LBN"
},
{
"regex": "^\\d{8}$",
"name": "Lesotho",
"iso2": "LS",
"iso3": "LSO"
},
{
"regex": "^[A-Z0-9]{8}$",
"name": "Libya",
"iso2": "LY",
"iso3": "LBY"
},
{
"regex": "^[a-zA-Z]\\d{5}$",
"name": "Liechtenstein",
"iso2": "LI",
"iso3": "LIE"
},
{
"regex": "^[A-Z0-9]{8}$",
"name": "Lithuania",
"iso2": "LT",
"iso3": "LTU"
},
{
"regex": "^[A-Z0-9]{8}$",
"name": "Luxembourg",
"iso2": "LU",
"iso3": "LUX"
},
{
"regex": "^\\d{12}$",
"name": "Madagascar",
"iso2": "MG",
"iso3": "MDG"
},
{
"regex": "^\\d{8}$",
"name": "Malawi",
"iso2": "MW",
"iso3": "MWI"
},
{
"regex": "^[AHK]\\d{8}$",
"name": "Malaysia",
"iso2": "MY",
"iso3": "MYS"
},
{
"regex": "^\\d{7}$",
"name": "Maldives",
"iso2": "MV",
"iso3": "MDV"
},
{
"regex": "^\\d{7}$",
"name": "Malta",
"iso2": "MT",
"iso3": "MLT"
},
{
"regex": "^\\d{8}$",
"name": "Mauritius",
"iso2": "MU",
"iso3": "MUS"
},
{
"regex": "^\\d{10,11}$",
"name": "Mexico",
"iso2": "MX",
"iso3": "MEX"
},
{
"regex": "^[A-Z]{2}\\d{7}$",
"name": "Micronesia",
"iso2": "FM",
"iso3": "FSM"
},
{
"regex": "^\\d{8}$",
"name": "Moldova",
"iso2": "MD",
"iso3": "MDA"
},
{
"regex": "^\\d{7}$",
"name": "Mongolia",
"iso2": "MN",
"iso3": "MNG"
},
{
"regex": "^[A-Z]{2}\\d{7}$",
"name": "Montenegro",
"iso2": "ME",
"iso3": "MNE"
},
{
"regex": "^\\d{9}$",
"name": "Morocco",
"iso2": "MA",
"iso3": "MAR"
},
{
"regex": "^([A-Z]{2}\\d{7})|(\\d{2}[A-Z]{2}\\d{5})$",
"name": "Mozambique",
"iso2": "MZ",
"iso3": "MOZ"
},
{
"regex": "^\\d{9}$",
"name": "Namibia",
"iso2": "NA",
"iso3": "NAM"
},
{
"regex": "^\\d{7}$",
"name": "Nepal",
"iso2": "NP",
"iso3": "NPL"
},
{
"regex": "^[A-Z]{2}[A-Z0-9]{6}\\d$",
"name": "Netherlands",
"iso2": "NL",
"iso3": "NLD"
},
{
"regex": "^([Ll]([Aa]|[Dd]|[Ff]|[Hh])|[Ee]([Aa]|[Pp])|[Nn])\\d{6}$",
"name": "New Zealand",
"iso2": "NZ",
"iso3": "NZL"
},
{
"regex": "^\\d{9}$",
"name": "Nicaragua",
"iso2": "NI",
"iso3": "NIC"
},
{
"regex": "^[A-Z]{2}\\d{7}$",
"name": "Niger",
"iso2": "NE",
"iso3": "NER"
},
{
"regex": "^[A-Z]{2}\\d{7}$",
"name": "Nigeria",
"iso2": "NG",
"iso3": "NGA"
},
{
"regex": "^\\d{6}$",
"name": "Niue",
"iso2": "NU",
"iso3": "NIU"
},
{
"regex": "^\\d{8}$",
"name": "North Macedonia",
"iso2": "MK",
"iso3": "MKD"
},
{
"regex": "^[A-Z]{2}\\d{7}$",
"name": "Norway",
"iso2": "NO",
"iso3": "NOR"
},
{
"regex": "^[A-Z]{2}\\d{7}$",
"name": "Oman",
"iso2": "OM",
"iso3": "OMN"
},
{
"regex": "^[A-Z]{2}\\d{7}$",
"name": "Pakistan",
"iso2": "PK",
"iso3": "PAK"
},
{
"regex": "^\\d{7}$",
"name": "Panama",
"iso2": "PA",
"iso3": "PAN"
},
{
"regex": "^[A-Z]{2}\\d{6}$",
"name": "Paraguay",
"iso2": "PY",
"iso3": "PRY"
},
{
"regex": "^\\d{8}$",
"name": "Peru",
"iso2": "PE",
"iso3": "PER"
},
{
"regex": "^([A-Z](\\d{6}|\\d{7}[A-Z]))|([A-Z]{2}(\\d{6}|\\d{7}))$",
"name": "Philippines",
"iso2": "PH",
"iso3": "PHL"
},
{
"regex": "^[A-Z]{2}\\d{7}$",
"name": "Poland",
"iso2": "PL",
"iso3": "POL"
},
{
"regex": "^[A-Z]\\d{6}$",
"name": "Portugal",
"iso2": "PT",
"iso3": "PRT"
},
{
"regex": "^\\d{9}$",
"name": "Puerto Rico",
"iso2": "PR",
"iso3": "PRI"
},
{
"regex": "^[A-Z]{2}\\d{7}$",
"name": "Qatar",
"iso2": "QA",
"iso3": "QAT"
},
{
"regex": "^\\d{8,9}$",
"name": "Romania",
"iso2": "RO",
"iso3": "ROU"
},
{
"regex": "^\\d{9}$",
"name": "Russia",
"iso2": "RU",
"iso3": "RUS"
},
{
"regex": "^\\d{8}$",
"name": "Rwanda",
"iso2": "RW",
"iso3": "RWA"
},
{
"regex": "^[A-Z]{2}\\d{7}$",
"name": "Samoa",
"iso2": "WS",
"iso3": "WSM"
},
{
"regex": "^[A-Z]{2}\\d{6}$",
"name": "San Marino",
"iso2": "SM",
"iso3": "SMR"
},
{
"regex": "^\\d{9}$",
"name": "Saudi Arabia",
"iso2": "SA",
"iso3": "SAU"
},
{
"regex": "^\\d{9}$",
"name": "Senegal",
"iso2": "SN",
"iso3": "SEN"
},
{
"regex": "^\\d{9}$",
"name": "Serbia",
"iso2": "RS",
"iso3": "SRB"
},
{
"regex": "^\\d{8}$",
"name": "Seychelles",
"iso2": "SC",
"iso3": "SYC"
},
{
"regex": "^(P)[A-Z]\\d{7}$",
"name": "Sierra Leone",
"iso2": "SL",
"iso3": "SLE"
},
{
"regex": "^[A-EGHJKLMNPRTUWXYZ][0-9]{7}[A-EGHJKLMNPRTUWXYZ]$",
"name": "Singapore",
"iso2": "SG",
"iso3": "SGP"
},
{
"regex": "^[0-9A-Z]\\d{7}$",
"name": "Slovakia",
"iso2": "SK",
"iso3": "SVK"
},
{
"regex": "^\\d{8}$",
"name": "Slovenia",
"iso2": "SI",
"iso3": "SVN"
},
{
"regex": "^\\d{8}$",
"name": "Solomon Islands",
"iso2": "SB",
"iso3": "SLB"
},
{
"regex": "^[A-Z]{2}\\d{6}$",
"name": "Somalia",
"iso2": "SO",
"iso3": "SOM"
},
{
"regex": "^[TAMD]\\d{8}$",
"name": "South Africa",
"iso2": "ZA",
"iso3": "ZAF"
},
{
"regex": "^[MS]\\d{8}$",
"name": "South Korea",
"iso2": "KR",
"iso3": "KOR"
},
{
"regex": "^[A-Z0-9]{2}([A-Z0-9]?)\\d{6}$",
"name": "Spain",
"iso2": "ES",
"iso3": "ESP"
},
{
"regex": "^\\d{9}$",
"name": "Sri Lanka",
"iso2": "LK",
"iso3": "LKA"
},
{
"regex": "^[A-Z]{2}\\d{6}$",
"name": "Suriname",
"iso2": "SR",
"iso3": "SUR"
},
{
"regex": "^\\d{8}$",
"name": "Sweden",
"iso2": "SE",
"iso3": "SWE"
},
{
"regex": "^[A-Z]\\d{7}$",
"name": "Switzerland",
"iso2": "CH",
"iso3": "CHE"
},
{
"regex": "^[A-Z]{2}\\d{8}$",
"name": "Taiwan",
"iso2": "TW",
"iso3": "TWN"
},
{
"regex": "^[A-Z]{2}\\d{7}$",
"name": "Tajikistan",
"iso2": "TJ",
"iso3": "TJK"
},
{
"regex": "^[A-Z]{1}\\d{8}$",
"name": "Tanzania",
"iso2": "TZ",
"iso3": "TZA"
},
{
"regex": "^[A-Z]{1,2}\\d{6,7}$",
"name": "Thailand",
"iso2": "TH",
"iso3": "THA"
},
{
"regex": "^[A-Z]{2}\\d{7}$",
"name": "Togo",
"iso2": "TG",
"iso3": "TGO"
},
{
"regex": "^[A-Z]{1}\\d{7}$",
"name": "Tonga",
"iso2": "TO",
"iso3": "TON"
},
{
"regex": "^[A-Z]{2}\\d{7}$",
"name": "Turkmenistan",
"iso2": "TM",
"iso3": "TKM"
},
{
"regex": "^[A-Z]{2}\\d{6}$",
"name": "Ukraine",
"iso2": "UA",
"iso3": "UKR"
},
{
"regex": "^\\d{9}$",
"name": "United Arab Emirates",
"iso2": "AE",
"iso3": "ARE"
},
{
"regex": "^\\d{9}$",
"name": "United Kingdom",
"iso2": "GB",
"iso3": "GBR"
},
{
"regex": "^[a-zA-Z0-9]{9}$",
"name": "United States",
"iso2": "US",
"iso3": "USA"
},
{
"regex": "^[A-Z]{2}\\d{6}$",
"name": "Uruguay",
"iso2": "UY",
"iso3": "URY"
},
{
"regex": "^\\d{7,8}$",
"name": "Uzbekistan",
"iso2": "UZ",
"iso3": "UZB"
},
{
"regex": "^\\d{7}$",
"name": "Vanuatu",
"iso2": "VU",
"iso3": "VUT"
},
{
"regex": "^[A-Z]{1}\\d{6}$",
"name": "Venezuela",
"iso2": "VE",
"iso3": "VEN"
},
{
"regex": "^[A-Z0-9]{9}$",
"name": "Vietnam",
"iso2": "VN",
"iso3": "VNM"
},
{
"regex": "^[A-Z]{2}\\d{6}$",
"name": "Tunisia",
"iso2": "TN",
"iso3": "TUN"
},
{
"regex": "^\\d{8}$",
"name": "Zambia",
"iso2": "ZM",
"iso3": "ZMB"
},
{
"regex": "^[A-Z]{2}\\d{7}$",
"name": "Zimbabwe",
"iso2": "ZW",
"iso3": "ZWE"
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment