Struts2 + Validation + RegularExpression
I want to write a regular expression to validate input of this format:
00:00 -> 24:00
And it represents 24 hours o开发者_如何学编程f a day.
Any thoughts how to create such a regular expression?
BR SC
I use this one that is simple and well explained, gotten from the www.mkyong.com site
[01]?[0-9]|2[0-3]):[0-5][0-9]
( #start of group #1
[01]?[0-9] # start with 0-9,1-9,00-09,10-19
| # or
2[0-3] # start with 20-23
) #end of group #1
: # follow by a semi colon (:)
[0-5][0-9] # follow by 0..5 and 0..9, which means 00 to 59
精彩评论