I need a regular expression that detects timer strings that could be less than or greater than a minute. So the expression would need to match both:
35.54 and 1:03.24
I need a regular expression that detects timer strings that could be less than or greater than a minute. So the expression would need to match both:
35.54 and 1:03.24
(\d+:)?(\d{2})\.(\d{2})
1 or more digits, and a colon (optional)
2 digits
dot
2 digits
For each matched group, ensure that the numbers make sense. Embedding 0-60 in regex is just silly.
matching = regex.text( str );
matching |= $2 < 60;
matching |= $3 < 60;
(\d?\d?):?(\d\d)\.(\d\d)
This will match both types of strings and allows the time elements to be referenced as 3 separate capturing groups