Regex for German Zip Codes

Posted on Tue 05 July 2016 in General Software Development • Tagged with regex, zip code

I found the following regular expression (source) working fine for me:

^(?!01000|99999)(0[1-9]\\d{3}|[1-9]\\d{4})$

I tried two alternatives that did not work because they were too general:

[0-9]{5}

^([0]{1}[1-9]{1}|[1-9]{1}[0-9]{1})[0-9]{3}$

The first regex matches the …


Continue reading