Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

pattern matching 1

Status
Not open for further replies.

molly2ka

Programmer
Mar 20, 2004
27
US
Hi all,

i'm a newbie to javascript and I am trying to use it to validate some user input data for a html form. I am stuck on checking if the user has input a time value in the correct format hh:mm:ss

so far i've got

var regTime = /^\d{2}\:\d{0-5}\d\:\d{0-5}\d$/

i'm trying mkae it so that 2 digits are followed by a colon, then a digit less than 6, a digit,a colon,a digit less than 6 and another digit. I've tried lots of variations but can't seem to find the right one. I know it's the 'digit between 0 and 5' that won't work and the expression above is rejected by the browser. Any ideas???

Manni
 
How about this?

var regTime = /^\d{2}:[0-5]\d:[0-5]\d$/

Adam
while(ignorance){perpetuate(violence,fear,hatred);life=life-1};
 
ur a star I know it's probably a simple question for the experts but i've been racking my brains!!

many thanks,

manni
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top