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-Za-z]\d[A-Za-z][-]?\d[A-Za-z]\d)
Description
Regular expression to match a canadian postal code where it matches a string with or without the hyphen and in upercase or lowercase
Matches
a1a-1a1 | A1A1A1
Non-Matches
1a1-a1a | aaa-aaa | 111-111
Author Rating: The rating for this expression. Rico lour
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: Canadian Postal Code regex is wrong
Name: Doug Steele
Date: 8/25/2004 1:56:18 PM
Comment:
According to Canada Post, a Canadian Postal code MUST have 1 space between the first 3 characters and the second 3 characters. No space or a dash are errors.


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