Rank: Member
Joined: 3/1/2006(UTC) Posts: 1,142
|
In Bvc5 SP3 we are including support for zip code validation based on regular expressions. We are going to include a regular expression for U.S. zip codes, but we do not have the time to research all of the countries of the world and make regular expressions for their zip codes. This post is going to be for people to either post regular expressions for a country's postal code or to explain in layman's terms the format of a zip code in a particular country so that it can be translated into a regular expression. Here are two regex's for United States and Canada. United States - ^\d{5}$ Canada - ^\D{1}\d{1}\D{1}\-?\d{1}\D{1}\d{1}$ (Also, I know that the regex for us zip codes only takes the 5 digits, but that is because some of the shipping services won't take a zip plus 5 code.) Edited by user Friday, June 3, 2016 1:07:35 PM(UTC)
| Reason: Not specified |
Justin Etheredge Senior Software Engineer BVSoftware |
|
|
|
Rank: Member
Joined: 8/17/2006(UTC) Posts: 681
|
Australia: 4 digits: I'd say the post code should be: ^\d{4}$ but don't take my word as RegExes are something I never managed to understand :) |
|
|
|
|
Rank: Member
Joined: 11/5/2003(UTC) Posts: 2,136
Was thanked: 1 time(s) in 1 post(s)
|
From the Regular Expression Library... PortugeseEthiopianIndia, IndiaCanada, Canada, CanadaGermany, Germany, GermanyUnited Kingdom, United KingdomBrazil, BrazilNetherlandDenmarkRussiaSwitzerlandAustralia Jamie Zawinski said...Some people, when confronted with a problem, think, "I know, I'll use regular expressions." Now they have two problems. [/quote] |
|
|
|
|
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.