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

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find Pattern Title
Expression
^[A-Z]{1}( |-)?[1-9]{1}[0-9]{3}$
Description
Postcode for Germany
Matches
A-1234 | A 1234 | A1234
Non-Matches
AA-1234 | A12345
Author Rating: Not yet rated. Henk de Vries
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: Postcode for Germany
Name: Guido Faust
Date: 1/29/2007 11:15:31 AM
Comment:
For Germany it should be ^[D]{1}( |-){0,1}?[0-9]{5}$ Postcodes in Germany may start with a leading 0 (e.g. 04315 Leipzig)


Title: Check for Austria or Suisse
Name: Guido Faust
Date: 1/29/2007 11:10:51 AM
Comment:
A check for Austria (A) or CH maybe ^((([A]{1})|([CH]{2}))( |-)){0,1}?[1-9]{1}[0-9]{3}$


Title: The 'A' is a demo character
Name: Henk himself
Date: 2/16/2006 8:31:46 AM
Comment:
Nope, the A in first letter of the example just stands for a letter, All kinds of letter kan be used.


Title: austria
Name: wurzl
Date: 11/13/2004 3:41:05 PM
Comment:
Sorry, dude. this regexp is for austria (see the big A in front of the code). try ^[1-9][0-9]{4}$ instead


Title: Postcode
Name: Marcus Krause
Date: 10/25/2003 4:34:55 PM
Comment:
Normally the first letter 'D-' is optional; you just use it for communication with foreign countries. Within Germany it isn't used!


Title: Postcode for Germany
Name: Graham Tritt
Date: 8/13/2003 5:36:24 AM
Comment:
After the reunification, German postcodes were reassigned and have now five digits. So I guess ^[A-Z]{1}( |-)?[1-9]{1}[0-9]{4}$ is the current match. But a first letter must be D. In Switzerland the post codes have a format like CH-1234.


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