Regex for German Zip Codes

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

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

The first regex matches the zip code “00000” which is invalid in the German system. The second regex matches the zip code “99999” which is invalid, too.

About the author


Software developer with experience in Java, JavaFX, EMF, OSGi, and a little bit of Swift. I live and work in Munich.

I use this website mainly as a journal and personal knowledge data base.

My PGP key is here. There are other keys listed for me, but I use this one exclusively.

Fingerprint: 232F 05C4 01BE F43D 0434 0A8A 4ED3 5720 477E EF40

View all posts

Leave a Reply

Your email address will not be published. Required fields are marked *