I need to determine the gametime of a soccer match. The gametime can always be written as mm:ss
. For example, the match starts with 00:00
. More importantly, my regex differs from the hour-limit because the official playing time stops at 90:00
. So, normally mm
is limited to ([0-5]?\d)
.In addition, I want to make my regex as robust as possible and I want to include the possibility of a lengthy injury-time. In this case, the match can end, for example, at 101:15
.
The colon-character is always in the middle between the two groups of digits.
With the help of Regular expression for matching HH:MM time format I came up with the following regex:
^([0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]$
How should I change this one to include the possibility of a third digit in the first group of digits, (m)mm
?
Thanks in advance