Validation Dutch postal code

0
I need to validate a field where a postal code can be entered for a Dutch adress (1001AB)   I found a regex to do this from the Mendix regex documentation but it isn’t working.    I am using this as my Regex isMatch($currentObject/Postcode, '[1-9][0-9][0-9][0-9] ?[A-Za-z][A-Za-z]')   No matter what I enter it’s not correct. 
asked
3 answers
1

Hey Finnbar,

The expression you are using is the correct one. Underneath you can see a screenshot of an implementation I did that does work.
Maybe try checking if your $currentObject/Postcode isn’t empty and is giving you a correct postal code before entering the decision? 
I’m thinking the problem might be your $currentObject/Postcode, instead of the regex, as this seems to be the correct one.


Good luck,

Cedric

Ps: I forgot to include the parameter ‘Postcode’ in my screenshot of this microflow ;)

answered
1

Hi,

use the below mentioned regex

isMatch($currentObject/Postcode, '^[1-9][0-9]{3} ?(?!sa|sd|ss|SA|SD|SS)[A-Za-z]{2}$')

Also, check the below link for reference,

https://stackoverflow.com/questions/17898523/regular-expression-for-dutch-zip-postal-code

Hope it helps!!!

answered
0

this is exactly the demo in the MX documentation about Regex.

https://docs.mendix.com/refguide/regular-expressions/

answered