maxhugen
Posts: 272
|
| Posted: 08/17/2008, 8:29 PM |
|
CCS has an Input Validation rule for 5-digit US Zipcodes:
^\d{5}$
However, many users use the 'extended' 9-digit zipcodes now.
Can anyone advise how to re-write the Input Validation to accept BOTH 5-digit and 9-digit codes pls?
Later, I'll have to tackle how to validate non-US codes as well - but that's for another day!
MTIA
_________________
Max
www.gardenloco.com | www.eipdna.com | www.chrisarminson.com |
 |
 |
wkempees
Posts: 1679
|
| Posted: 08/18/2008, 5:29 AM |
|
I asked our friend G:
'regexp zipcode 5 and 9'
it's response:
^\d{5}-\d{4}|\d{5}|[A-Z]\d[A-Z] \d[A-Z]\d$
http://regexlib.com/REDetails.aspx?regexp_id=23
for US 5 5-4 and Canadian
HTH
Walter
_________________
Origin: NL, T:GMT+1 (Forumtime +9)
CCS3/4.01.006 PhP, MySQL .Net/InMotion(Vista/XP, XAMPP)
if you liked this info PAYPAL me: http://donate.consultair.eu
|
 |
 |
maxhugen
Posts: 272
|
| Posted: 08/18/2008, 3:48 PM |
|
That's great, thanks Walter. One of these days, I'll have to do some study on regex expressions, but at the moment they're hieroglyphics to me!
_________________
Max
www.gardenloco.com | www.eipdna.com | www.chrisarminson.com |
 |
 |
wkempees
Posts: 1679
|
| Posted: 08/20/2008, 8:11 AM |
|
Max, http://regexlib.com
has many many examples and a good search function as well.
It even has a regex tester.
Saves one a lot of time.
Walter
_________________
Origin: NL, T:GMT+1 (Forumtime +9)
CCS3/4.01.006 PhP, MySQL .Net/InMotion(Vista/XP, XAMPP)
if you liked this info PAYPAL me: http://donate.consultair.eu
|
 |
 |
|