rash805115 / rnj

Online Shopping Portal
2 stars 3 forks source link

regex for correct zip code #12

Closed rash805115 closed 11 years ago

rash805115 commented 11 years ago

We need a regex for correct zip code. I will focus on it later.

in static/js/updateaccount.js -> verifyZip()

shivamdixit commented 11 years ago

You want to validate zip code of any specific country or zip code in general ? Different countries follow different norms and it would be difficult to create unified formula for all countries ! For example Canada has alphanumeric "postal codes"

rash805115 commented 11 years ago

Yeah...I am doing it just for USA. The regex does not have to be too complicated. Its just have to allow 5 digits.

On Fri, Oct 25, 2013 at 4:33 PM, Shivam Dixit notifications@github.comwrote:

You want to validate zip code of any specific country or zip code in general ? Different countries follow different norms and it would be difficult to create unified formula for all countries !

— Reply to this email directly or view it on GitHubhttps://github.com/rash805115/rnj/issues/12#issuecomment-27123503 .

Regards, Rahul Chaudhary Ph - 412-519-9634

shivamdixit commented 11 years ago

USA zip codes can be either 5 or 9 digit. Updated verifyZip() function. Allowed zip codes : DDDDD or DDDDD-DDDD

D = Digit

References : http://www.barnesandnoble.com/help/cds2.asp?PID=8134

rash805115 commented 11 years ago

refer 244406b13821166e804eed7b282636b9289e51e6