Needs review
Project:
CCK Address Extensions
Version:
5.x-1.6
Component:
India-Code
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
18 Mar 2008 at 14:09 UTC
Updated:
20 Mar 2008 at 04:48 UTC
The zipcode validation for indian pincodes has the following
//zip code is 6 digits with a possible space after third. first set is 1-9, second is 0-9
This is incorrect. 400056 is a valid pincode and it will fail the preg_match
preg_match("^[1-9]{3}\s{0,1}[0-9]{3}$", $item['zip'])
the correct validation should be
//zip code is 6 digits with a possible space after third. first digit is 1-9, next 2 digits are 0-9, followed by an optional space and 3 digits in the set [0-9]
and the preg_match would be
preg_match("/^[1-9]{1}[0-9]{2}\s{0,1}[0-9]{3}$/", $item['zip'])
| Comment | File | Size | Author |
|---|---|---|---|
| cck_address_india.module.patch | 1.23 KB | yasheshb |
Comments
Comment #1
rconstantine commentedThat's interesting. All of the regular expressions at (... oh, what is that site ... it's a huge regex library ... I can't seem to find it ...) agreed with the former definition. Could you point me to an online source with examples of ZIP codes like you describe? I just need a second confirmation.
However, as you'll see in other posts, I am currently unable to change the repository because it is screwed up. I may close this project and open a new one if it isn't fixed soon. So if I add your change, it will go in as soon as possible.