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-PR-UWYZ](\d([A-HJKSTUW]|\d)?|[A-HK-Y]\d([ABEHMNPRVWXY]|\d)?))\s*(\d[ABD-HJLNP-UW-Z]{2})?)|GIR\s*0AA)$
Description
matches uk postcodes according to specifications found at: http://www.govtalk.gov.uk/gdsc/html/noframes/PostCode-2-1-Release.htm
Matches
M1 1AA | EC1A 1BB | DN55 1PT
Non-Matches
SW17 8CB
Author Rating: Not yet rated. Chris Linseman
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: Fails on lower case
Name: Kumar
Date: 2/19/2009 4:47:43 AM
Comment:
The reg ex fails if the post code is entered in lower case.


Title: London postcodes
Name: Rob Kent
Date: 4/24/2008 11:14:04 AM
Comment:
This pattern doesn't match London postcodes, N1, E1 etc.


Title: sorry
Name: Iain
Date: 9/18/2006 9:28:21 AM
Comment:
wrong one (By the way take out the ^ and $) and it works


Title: Using asp.net
Name: Iain
Date: 9/18/2006 9:27:12 AM
Comment:
Ok I'm having real problems trying to get this to work with the regularexpressionvalidator in asp.net visual studio , why whould this be? any takers??


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