Lloyd
QuickBrownFox wrote:
Hey everybody,
I'm using a regular expression for validation here at work that I wanted some advice on. Specifically, it checks to see if the time is formatted correctly in the 12-hour format (hh:mm:ss (AM|PM)). So far, this is what I've got:
/^(0?[1-9]|1[0-2]):([0-5][0-9]):9[0-5][0-9]) (AM|PM)$/
I think this will do the trick, but if anyone notices something amiss, please let me know.
Now, my question is this: How would I change this to only allow times from 8:00 AM to 5:00 PM. If it were in 24 hour format, I suppose this wouldn't be that big of a deal. It'd be something like this:
/^(0?[89]|1[0-7]):([0-5][0-9]):9[0-5][0-9])$/
For now, though, I'd just like to keep it in 12-hour format. Any suggestions?
Thanks, Lloyd Brown
____________________
BYU Unix Users Group http://uug.byu.edu/ ___________________________________________________________________
List Info: http://uug.byu.edu/cgi-bin/mailman/listinfo/uug-list
____________________
BYU Unix Users Group http://uug.byu.edu/ ___________________________________________________________________
List Info: http://uug.byu.edu/cgi-bin/mailman/listinfo/uug-list
