-
Notifications
You must be signed in to change notification settings - Fork 103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bahrain (BH) postcode regex incorrect #207
Comments
I made a quick script to find all numbers on the page, the gist is here. The table on https://en.youbianku.com/Bahrain does seem to match this 1-12 range, so the following regexp would suffice: (?:\d|1[0-2])\d{2} |
@roelofr When I initially looked at the RegEx I too thought it would be okay but I had a play around and it seems to be ineffective for postcodes greater than 999: https://regex101.com/r/39cZU1/1/ I believe |
This is very expressive for a regex, but mostly, it seems the Google API doesn't return start or end markers, possibly to allow finding postal codes in longer strings. The pattern I posted matches 2103 matches So, to fix this, we probably need to check for word markers or EOLs. So, my v2 would be: (?:^|\b)(?:1[0-2]|[1-9])\d{2}(?:$|\b) I ran it again your pattern, and added a Small edit: made all groups non-capturing groups. |
Looks good to me! I'd be more than happy with that being implemented. |
Hi Ben. Yep, I will take a look and see if I'm able to make the change. |
Hi,
I believe the postcode regex for Bahrain to be incorrect.
https://www.gstatic.com/chrome/autofill/libaddressinput/chromium-i18n/ssl-aggregate-address/data/BH
It is currently
(?:\d|1[0-2])\d{2}
however I've found that postcodes are:And https://en.youbianku.com/Bahrain
The text was updated successfully, but these errors were encountered: