Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Faker::Address.uk_postcode can generate invalid postcodes. #44

garethrees opened this Issue Nov 10, 2011 · 1 comment


None yet
2 participants

This is the regex I've been using to validate them:

/^([A-PR-UWYZ0-9][A-HK-Y0-9][AEHMNPRTVXY0-9]?[ABEHMNPRVWXY0-9]? {1,2}[0-9][ABD-HJLN-UW-Z]{2}|GIR 0AA)$/

Which seems to be the correct one, as taken from StackOverflow

Faker generated BI56 3QX for me, which when you search in Google Maps is not recognised.

@stympy stympy closed this in 23303df Dec 27, 2011


stympy commented Dec 27, 2011

Please note that uk_postcode is deprecated... use postcode instead after setting Faker::Config.locale = 'en-gb'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment