I have been searching the net far and wide...but I am trying to find 1 Regular Expression to validate US, Canada, and Mexico Zip Codes using one validator...does anyone have one or know where i can get one.
Printable View
I have been searching the net far and wide...but I am trying to find 1 Regular Expression to validate US, Canada, and Mexico Zip Codes using one validator...does anyone have one or know where i can get one.
What is the format of zip-codes you want to match?
(I don't stay in any of these countries :))
Hey,
Have you checked out RegExLib? They have a whole library or regular expressions that you can use!
You can find a link to the website in my signature.
For instance:
US Zip Code:
http://regexlib.com/Search.aspx?k=us...=-1&m=-1&ps=20
Canada Zip Code:
http://regexlib.com/Search.aspx?k=ca...=-1&m=-1&ps=20
Hope that helps!!
Gary
The expression for Canadian Postal Codes in the above link is incorrect. The letters D, F, I, O, Q, or U are not used.
Hey,
I am sure the Regular Expression can be tweaked to the OP liking, but it would give him somewhere to start.
Gary
:)
This is my issue...i can find one or the other...but i can't find a single expression that will do both...and i am terrible at trying to get them to work (it is not my strong point).
Hey,
Why not just have two regular expressions? They are essentially doing two separate checks, so I don't see why doing two is an issue.
Gary