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

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find Valid UK Post Codes Upper and Lower Case
Expression
^ ?(([BEGLMNSWbeglmnsw][0-9][0-9]?)|(([A-PR-UWYZa-pr-uwyz][A-HK-Ya-hk-y][0-9][0-9]?)|(([ENWenw][0-9][A-HJKSTUWa-hjkstuw])|([ENWenw][A-HK-Ya-hk-y][0-9][ABEHMNPRVWXYabehmnprvwxy])))) ?[0-9][ABD-HJLNP-UW-Zabd-hjlnp-uw-z]{2}$
Description
Matches valid UK post codes in both upper and lower case, allowing for one or zero spaces between outcode and incodes.
Matches
SW112LE | SW11 2LE | sw112le
Non-Matches
12CR0LE | 12CR 0LE | SWLE05
Author Rating: Not yet rated. Gareth Wright
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: Mr
Name: Gareth Wright
Date: 5/12/2008 4:45:17 AM
Comment:
Not sure on there format Lyndon so can't comment at the moment. Why don't you click test on the right of my reg exp and give a few a try. Post back your results. Thanks, Gareth


Title: Post Code RegExp Question
Name: Lyndon
Date: 4/26/2008 9:53:33 AM
Comment:
Hi Gareth Does this regexp account for BFO post codes? That is British Forces Overseas. Regards Lyndon lyndon@infomediauk,net


Title: Post Code RegExp Question
Name: Lyndon
Date: 4/26/2008 9:53:10 AM
Comment:
Hi Gareth Does this regexp account for BFO post codes? That is British Forces Overseas. Regards Lyndon lyndon@infomediauk,net


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