3 ms·
(afaik GB has chars in zip codes) Yes the UK has letters in postcodes.
by rmc 13y ago
(afaik GB has chars in zip codes)
Yes the UK has letters in postcodes.
- jwdunne 13y agoAnd the regex to validate this is a monster, even noting that this still allows bad input: (GIR 0AA)|((([A-Z-[QVX]][0-9][0-9]?)|(([A-Z-[QVX]][A-Z-[IJZ]][0-9][0-9]?)|(([A-Z-[QVX]][0-9][A-HJKSTUW])|([A-Z-[QVX]][A-Z-[IJZ]][0-9][ABEHMNPRVWXY])))) [0-9][A-Z-[CIKMOV]]{2}) http://stackoverflow.com/questions/164979/uk-postcode-regex-comprehensive http://stackoverflow.com/questions/164979/uk-postcode-regex-...
- rmc 13y agoThe UK Government (after OSM took off) started to open source and release more data. You can download[1] the database of most of the UK postcodes[2] and their latitude & longitude. So if you want to really verify a GB postcode, you can just check it against the list [1] It's called 'Code Point Open' and you can 'order' it (for free) here http://www.ordnancesurvey.co.uk/business-and-government/products/opendata-products.html http://www.ordnancesurvey.co.uk/business-and-government/prod... [2] It's most of UK. It doesn't include Northern Ireland