-
-
Save bradydan/e172c3f99e211e6e47ad84f08f83dfe3 to your computer and use it in GitHub Desktop.
COUNTRIES_WITHOUT_POSTCODES = [ | |
[ "Angola", "AO" ], | |
[ "Antigua and Barbuda", "AG" ], | |
[ "Aruba", "AW" ], | |
[ "Bahamas", "BS" ], | |
[ "Belize", "BZ" ], | |
[ "Benin", "BJ" ], | |
[ "Bolivia", "BO" ], | |
[ "Botswana", "BW" ], | |
[ "Burkina Faso", "BF" ], | |
[ "Burundi", "BI" ], | |
[ "Cameroon", "CM" ], | |
[ "Central African Republic", "CF" ], | |
[ "Chad", "TD" ], | |
[ "Comoros", "KM" ], | |
[ "Congo", "CG" ], | |
[ "Congo, Democratic Republic of the", "CD" ], | |
[ "Cook Islands", "CK" ], | |
[ "Cote d'Ivoire", "CI" ], | |
[ "Curaçao", "CW" ], | |
[ "Djibouti", "DJ" ], | |
[ "Dominica", "DM" ], | |
[ "Equatorial Guinea", "GQ" ], | |
[ "East Timor", "TL" ], | |
[ "Eritrea", "ER" ], | |
[ "Fiji", "FJ" ], | |
[ "French Southern Territories", "TF" ], | |
[ "Gabon", "GA" ], | |
[ "Gambia", "GM" ], | |
[ "Grenada", "GD" ], | |
[ "Guyana", "GY" ], | |
[ "Heard and McDonald Islands", "HM" ], | |
[ "Hong Kong", "HK" ], | |
[ "Kiribati", "KI" ], | |
[ "Macao", "MO" ], | |
[ "Mali", "ML" ], | |
[ "Mauritania", "MR" ], | |
[ "Nauru", "NR" ], | |
[ "Netherlands Antilles", "AN" ], | |
[ "Niue", "NU" ], | |
[ "North Korea", "KP" ], | |
[ "Qatar", "QA" ], | |
[ "Rwanda", "RW" ], | |
[ "Sao Tome and Principe", "ST" ], | |
[ "Seychelles", "SC" ], | |
[ "Sierra Leone", "SL" ], | |
[ "Solomon Islands", "SB" ], | |
[ "South Sudan", "SS" ], | |
[ "Suriname", "SR" ], | |
[ "Syria", "SY" ], | |
[ "Tokelau", "TK" ], | |
[ "Togo", "TG" ], | |
[ "Tonga", "TO" ], | |
[ "Tuvalu", "TV" ], | |
[ "Uganda", "UG" ], | |
[ "United Arab Emirates", "AE" ], | |
[ "Vanuatu", "VU" ], | |
[ "Yemen", "YE" ], | |
[ "Zimbabwe", "ZW" ] | |
] |
Congo is repeated twice
Congo is repeated twice
It’s given two country codes here
UPDATE: Congo
and Congo, Democratic Republic of the
are two separate countries.
However, this list is probably out of date now. For instance, Ireland has postcodes (“Eircode”): https://en.wikipedia.org/wiki/Postal_addresses_in_the_Republic_of_Ireland
So, treat with caution
Note: updated now
I have created an updated list for anyone in need.
I have created an updated list for anyone in need.
A list without country codes won’t be of use to many (programmatically, at least). There are often multiple ‘long’ variants of country names. I’m interested to know what the updates are based upon.
I have created an updated list for anyone in need.
A list without country codes won’t be of use to many (programmatically, at least).
You are absolutely right, will update here once I've created a more comprehensive list
Please see this updated list with countries, postal code regexes, abbreviations and ranges (where applicable). It is very usable programmatically but is subject to human error as everything was mostly done manually.
One can simply check if a postal property exists, and validate postal codes with that code. The countries with no postal codes will not have a postal property.
Looks good. You might want to add UK as a duplicate of GB.
GB is the correct ISO code, but UK is the country it represents (Great Britain is an island, and not equivalent to UK. For instance, Northern Ireland is in the UK but not in Great Britain)
Nicaragua and UAE do not use postal codes officially. I can confirm from our own operations as a company and staff we have out there.
@MaxShineOn Updated
Changes based on https://en.wikipedia.org/wiki/List_of_postal_codes
Removed:
- Ireland "IE"
- Malawi "MW"
- Mauritius "MU"
- Montserrat "MS"
- Panama "PA"
- Saint Kitts and Nevis "KN"
- Saint Lucia "LC"
- Somalia "SO"
- South Africa "ZA"
- Tanzania, United Republic of "TZ"
- Timor-Leste "TL"
- Trinidad and Tobago "TT"
Added:
- Gabon
- Bolivia
- Chad
- Curaçao
- East Timor
- Heard and McDonald Islands
- South Sudan
- Togo
Like these