GeoNames Home | Postal Codes | Download / Webservice | About 

GeoNames Forum
  [Search] Search   [Recent Topics] Recent Topics   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
Updating GB Postal Regex in countryinfo.txt  XML
Forum Index -> General
Author Message
inchcrest



Joined: 04/01/2018 22:12:19
Messages: 2
Offline

Hi,

I just discovered this project, and it is awesome. I downloaded the countryinfo.txt file in order to get regexes for postal codes across the world. I noticed the GB postal code regex was not working for some of my test postal codes.

I was wondering if we could update the regex to be the same as the one recommended here: https://en.wikipedia.org/wiki/Postcodes_in_the_United_Kingdom#Validation

Code:
 ^([Gg][Ii][Rr] 0[Aa]{2})|((([A-Za-z][0-9]{1,2})|(([A-Za-z][A-Ha-hJ-Yj-y][0-9]{1,2})|(([A-Za-z][0-9][A-Za-z])|([A-Za-z][A-Ha-hJ-Yj-y][0-9]?[A-Za-z])))) [0-9][A-Za-z]{2})$
 



Or if someone could point me in the right direction on how to do it myself? I couldn't find any clear documentation on how to update the countryinfo.txt file.

Thanks
inchcrest



Joined: 04/01/2018 22:12:19
Messages: 2
Offline

I thought I'd update this with a javascript test of the current regex and the proposed regex. I hopte this'll make my argument a little more concrete.

https://jsfiddle.net/inchcrest/om49bcwd/

Thanks
 
Forum Index -> General
Go to:   
Powered by JForum 2.1.5 © JForum Team