Link to home
Start Free TrialLog in
Avatar of sah18
sah18Flag for United States of America

asked on

regular expression validator for textbox to hold a time

Can someone help me with how to set a validator for a textbox control to make sure that a valid time has been entered?  
Time in in 24-hour format (examples):
9:00 or 09:00
13:00
23:59

I'm thinking I need to use the regular expression validator for this, but I'm not certain is that's the right validator to use.

thanks.
Avatar of nauman_ahmed
nauman_ahmed
Flag of United States of America image

Hey this is an expression using regular expression validator:

^(20|21|22|23|[0-1]\d)[0-5]\d$

but this works only like this:

07:30 wrong

0730  correct

try it and you will see


also follow this link..its a tutorial to code validators..

http://www.intellectualconceptsinc.com/library/regular%20expressions.pdf
ASKER CERTIFIED SOLUTION
Avatar of rstrader
rstrader

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of sah18

ASKER

rstrader- i just finally got around to trying this today.  it works perfectly!  exactly what i was hoping for!!

do you know of any good tutorials on regular expression syntax?  i'd really like to learn it better!  thanks again.