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,2}[0-9]{1,2})|([A-Z]{1,2}[0-9][A-Z]))\s?([0-9][A-Z]{2})$
Description
Matches UK postcodes of the below formats. The space is optional. AN NAA AAN NAA ANN NAA ANA NAA AANA NAA AANN NAA
Matches
A11AA | AA1A 1AA | AA11 1AA
Non-Matches
AAA 1AA | AA11A 1AA | AAA1AA
Author Rating: The rating for this expression. Phil A
Source Andy and myself
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: slight ammend
Name: _Belial
Date: 1/25/2005 12:28:00 PM
Comment:
you need to change the above regex to let you use lower-case letters in postcodes :) ^(([A-Za-z]{1,2}[0-9]{1,2})|([A-Za-z]{1,2}[0-9][A-Z]))\s?([0-9][A-Za-z]{2})$


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