[thelist] validation expression help

Joshua Olson joshua at waetech.com
Wed Dec 29 20:09:32 CST 2004


> -----Original Message-----
> From: Casey Crookston
> Sent: Wednesday, December 29, 2004 7:51 PM
> 
> I need to use a Validation Expression to make sure a date is entered
> correctly.
> 
> ValidationExpression="\d{2}/\d{2}/\d{4}"
> 
> That works unless the date is something like 1/1/2004.
> 
> ValidationExpression="\d{1}/\d{1}/\d{4}"
> 
> That works unless the date is something like 10/10/2004.
> 
> How do you build an option into the expression to allow 1 or 
> 2 numbers?

Casey,

ValidationExpression="\d{1,2}/\d{1,2}/\d{4}"

I understand that this may be a quick'n'dirty solution, but I'd encourage
you to check around for a more robust regex as this expression allows for
obviously invalid input.  Google is your best friend.

<><><><><><><><><><>
Joshua Olson
Web Application Engineer
WAE Tech Inc.
http://www.waetech.com/service_areas/
706.210.0168 




More information about the thelist mailing list