Reputation: 20183
I found this regex
var zipCodePattern = /^\d{5}$|^\d{5}-\d{4}$/;
That won't validate: 12345, but it does validate 07179. I need to be sure that it would work worldwide, would it? If not, does it exist?
Upvotes: 0
Views: 885
Reputation: 2262
No, in some countries(India, for eg.), the Zip Code is of 6 digits and in some others, it might be entirely different with spaces also. Your expression should support that too.
Upvotes: 4