Click here to Skip to main content
15,898,222 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I want to write a regular expression that validate only minutes, seconds and hundredths. Any idea how to write it?

Thanks
Posted
Comments
Sergey Alexandrovich Kryukov 17-Jun-15 0:00am    
Idea?! What have you tried so far?
—SA

1 solution

The time parts vary from 00 to 59, in Regex pattern, it will be
[0-5]\d

where
[0-5] => 0 to 5
\d => 0 to 9
Repeat this pattern 3 times with : as delimiter, you will get the answer.
Learn more: The 30 Minute Regex Tutorial[^]
 
Share this answer
 
v4

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900