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

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find Canada postal code
Expression
^[ABCEGHJKLMNPRSTVXYabceghjklmnprstvxy]{1}\d{1}[A-Za-z]{1}\d{1}[A-Za-z]{1}\d{1}$
Description
Matches the Canadian postal code with no space between.
Matches
M4S1G9 | m6p1l1 | m4s1G9
Non-Matches
M4S 1G9 | m6p 1l1 | m4s 1G9
Author Rating: The rating for this expression. Nassim Ghods
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: space and dash
Name: Tony
Date: 5/16/2009 10:49:31 PM
Comment:
It should handle space or dash in the postal code. Here is my revised expression: ^[ABCEGHJKLMNPRSTVXYabceghjklmnprstvxy]{1}\d{1}[A-Za-z]{1}( |-)?\d{1}[A-Za-z]{1}\d{1}$


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