Validator.js: Netherlands zipcode validation

Created on 29 Jan 2020  路  5Comments  路  Source: validatorjs/validator.js

Looks like netherlands zipcode validation isn't quite correct. I ran into the following location: De Weven 7, 3583 Paal, Belgium (https://goo.gl/maps/GKxgsCkMjm4qtdVu5) that doesn't include the space and 2 a-z characters. Also not sure how valid, but http://www.geonames.org/postalcode-search.html?q=3583&country=NL (37) looks like it also lists the inclusion of those two characters as well as not having them. Guessing it should just be zero or 2 times a-z. I do see a wikapedia article talking about adding them in 2005, but it looks like it was to have more combinations and the exclusion of it is actually a combination. Unless I'm mistaken.

馃嵖 discussion

Most helpful comment

Hi @MusicMonkey5555,
If you run De Weven 7, 3583 Paal, Belgium it is correct that you get an error! Because thats not in the Netherlands. Begium its postal code is for example1234 and not 1234 AB.

Belgium = BE: fourDigit, === const fourDigit = /^\d{4}$/;
Netherlands = NL: /^\d{4}\s?[a-z]{2}$/i,

I'm from the Netherlands :) and the company where i work delivers in NL and in BE so postalcodes must be correct for us :)

The also speak Dutch and French but the have there own postal code the Belgium.

All 5 comments

PR welcome!

Hi @MusicMonkey5555,
If you run De Weven 7, 3583 Paal, Belgium it is correct that you get an error! Because thats not in the Netherlands. Begium its postal code is for example1234 and not 1234 AB.

Belgium = BE: fourDigit, === const fourDigit = /^\d{4}$/;
Netherlands = NL: /^\d{4}\s?[a-z]{2}$/i,

I'm from the Netherlands :) and the company where i work delivers in NL and in BE so postalcodes must be correct for us :)

The also speak Dutch and French but the have there own postal code the Belgium.

@MusicMonkey5555 The address is in Belgium and Belgium postal codes are as stated by @NielsvanDijk 4 numbers wikipedia 馃憖

The only gripe could be that the isPostalCode validator does not support the, not widely used, country code prefix :smiling_imp:

i.e. BE 1234

Sorry I looked up the original ticket someone had and the address they entered was actually:
De Weven 7
Paal, Utrecht 3583
NL
Which looks like it is in the netherlands. They had mentioned it was going to Runners lab and I was assuming it was the one at RS Scan and just looked up that address. (https://www.google.com/maps/place/Utrecht,+Netherlands/@52.0842715,5.0124522,12z/data=!3m1!4b1!4m8!1m2!2m1!1sPaal,+Utrecht!3m4!1s0x47c66f4339d32d37:0xd6c8fc4c19af4ae9!8m2!3d52.0907374!4d5.1214201)
But maybe the postal code must be incorrect. I will double check the address with some people, thank you for all your international feedback!

After checking with several people they are in the same building and all in Belgium so the wrong country code. Thank again everyone! I'll close it since it's a non-issue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mfbx9da4 picture mfbx9da4  路  4Comments

jaxkodex picture jaxkodex  路  3Comments

malkhuzayyim picture malkhuzayyim  路  4Comments

RPDeshaies picture RPDeshaies  路  4Comments

IOAyman picture IOAyman  路  4Comments