| Title |
Test
Find
Dutch zip code
|
| Expression |
[1-9][0-9]{3}[ ]?(([a-rt-zA-RT-Z][a-zA-Z])|([sS][bce-rt-xBCE-RT-X])) |
| Description |
Most RegExpr for dutch zip codes are too simple. For historic reasons, the two-letter combinations SS, SA and SD are not allowed.
There should be one space between the numbers and letters, but I allow any number of spaces. Also I allow lowercase. In the early days of dutch zip codes, some letters were not allowed to avoid confusion (F,I,Q, O etc). Nowadays, they are not excluded anymore, because we ran out of letter combinations.
It should be easy to make the RegExpr more strict, by prescribing ONE mandatory space and allowing only uppercase. |
| Matches |
1234HG | 3454 FG | 1000 AA | 3456 sg |
| Non-Matches |
0987 SE | 8767 SD | 6756 ss |
| Author |
Rating:
Not yet rated.
Erik Terwiel
|
| Source |
|
| Your Rating |
|
Title: The term 'Dutch' is wrong!
Name: Oscar
Date: 8/31/2011 12:13:03 AM
Comment:
The term 'Dutch' is wrong! This is a postal code from The Netherlands, not 'Dutch'!
'Dutch' is NOT a country but a language which is spoken in different countries (with different forms of postal codes).
As such, please do not use such a regexp if you know you' users speak 'Dutch'. Their postal code might be quite different!
Title: Case-insensitive makes it shorter
Name: Loe Spee
Date: 5/19/2011 9:47:42 AM
Comment:
Or you can make the regex case-insensitive by using the i flag.
/[1-9][0-9]{3}[ ]?(([a-rt-z][a-z])|([s][bce-rt-x]))/i