Regex Dutch postcode (postal code)

0
I've tried the following regular expressions separately, but entering 1000AB into the string $Selectievraag/PostcodeTmAntwoord and having the entry checked in an exclusive split in an On Change microflow results in a false each time. Anyone knows why? isMatch($SelectieVraag/PostcodeTmAntwoord,'/^[1-9][0-9]{3} (?!sa|sd|ss)[a-z]{2}$/i') isMatch($SelectieVraag/PostcodeTmAntwoord,'/^[1-9][0-9]{3} ?(?!sa|sd|ss)[a-z]{2}$/i') isMatch($SelectieVraag/PostcodeTmAntwoord,'^[1-9][0-9]{3} (?!sa|sd|ss)[a-z]{2}$i') isMatch($SelectieVraag/PostcodeTmAntwoord,'^[1-9][0-9]{3} ?(?!sa|sd|ss)[a-z]{2}$i')    
asked
2 answers
3

I use always this one:

isMatch($PostcodeHoofdletters, '^[1-9][0-9]{3}\s?[a-zA-Z]{2}$')

Right values    1234AB | 1234 AB | 1001 AB
Wrong values  0123AB | 1234A B | 0123 AB

Regards,

Ronald

 

answered
2

I've tested the following regular expression with https://regex101.com/ which matches capital and lower case combinations, with or without a space between the numbers and letters, while not allowing certain abbreviations related to the nazi regime ( sa|sd|ss).

^[1-9][0-9]{3}\s?(?!sa|sd|ss)[a-zA-Z]{2}$

'\s' can be omitted to not allow spaces

[a-zA-Z] can be changed to either [a-z] for only lower case matches or [A-Z] for only upper case matches

answered