RegExLib.com - The first Regular Expression Library on the Web!

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find Pattern Title
Expression
\b((?:0[1-46-9]\d{3})|(?:[1-357-9]\d{4})|(?:[4][0-24-9]\d{3})|(?:[6][013-9]\d{3}))\b
Description
This is my attempt to find out valid german postal codes (PLZ or Postleitzahlen). After the German Unification the numbers were changed to a five digit system. The postal codes starts with the two digit "Leitzahl". This is a number between 00 and 99 excluding the not yet used numbers: 00, 05, 43 and 62! After that follows directly a three digit number, 000-999. Comments welcome. This works for me, however I think it could be written more compact, but could not figure out how ;-) For more information on german postal codes see: http://de.wikipedia.org/wiki/Liste_der_Postleitbereiche_Deutschland http://de.wikipedia.org/wiki/Postleitzahl_%28Deutschland%29 http://en.wikipedia.org/wiki/List_of_postal_codes_in_Germany
Matches
12556 | 01550 | 80796
Non-Matches
05234 | 8973 | 62980
Author Rating: The rating for this expression. Markus Matern
Source
Your Rating
Bad Good

Enter New Comment

Title
 
Name
 
Comment
 
Spammers suck - we apologize. Please enter the text shown below to enable your comment (not case sensitive - try as many times as you need to if the first ones are too hard):

Existing User Comments

Title: Thanks
Name: JohannesG
Date: 10/17/2014 4:10:48 AM
Comment:
really nice pattern for German PLZ! Thanks


Title: Thanks
Name: JohannesG
Date: 10/17/2014 4:10:42 AM
Comment:
really nice pattern for German PLZ! Thanks


Title: non-exisiting zipCode match
Name: jupp
Date: 5/4/2011 4:10:51 AM
Comment:
a very nice pattern, matches non-existing zipCodes 12345 and 99999, though


Copyright © 2001-2018, RegexAdvice.com | ASP.NET Tutorials