Preserved Topic: another JS RegExp problem (Page 1 of 1) |
|
---|---|
Obsessive-Compulsive (I) Inmate From: Phoenix, Az, USA |
posted 06-27-2002 22:32
Hi everyone. I'm trying to test to see if a user has entered a correct zip code in a form. I'm getting wierd errors and I don't know why. |
Lunatic (VI) Mad Scientist From: Massachusetts, USA |
posted 06-27-2002 22:55
The problem is that the following string: |
Obsessive-Compulsive (I) Inmate From: Phoenix, Az, USA |
posted 06-27-2002 23:21
wonderful, thank you for your help. I assumed I was missing something as I am new to regular expression. |
Maniac (V) Mad Scientist From: 100101010011 <-- right about here |
posted 06-28-2002 05:15
um... I'm not gonna knock you for using regexp's (and learning them it's a great skill, kinda like SQL that you use with virtually all languages). |
Lunatic (VI) Mad Scientist From: Massachusetts, USA |
posted 06-28-2002 05:25
Well, a reg exp is also able to make sure that they're all digits simultaneously. |
Bipolar (III) Inmate From: USA! USA! USA! |
posted 06-28-2002 15:41
regexes are the future of all computing! okay, maybe not, but for field validation (i.e. string parsing), there's nothing better. how long would the code be to test for an extended ZIP code? well, my regex is simple: |
Lunatic (VI) Mad Scientist From: Massachusetts, USA |
posted 06-28-2002 16:12
Of course, even those RegExp's won't keep me from entering "00000" as my zip code, which is what I always do =) |
Bipolar (III) Inmate From: USA! USA! USA! |
posted 07-01-2002 15:42
What you are proving by entering 00000 is that there is no substitute for server-side validation. Too often I have come across applications in a production environment that rely solely on client-side validation. |