I have an application where I want to check time input. Allowed forms for minutes(m, anything from 0-9999) and seconds(s, between 0-59) are:

```
s
ss
m:ss
...
mmmm:ss

```

and my current regexp I have is:

```
^([0-9]){0,4}(?=\:)\:?([0-5]){0,1}([0-9]){1}|([0-5]){0,1}([0-9]){1}$

```

which matches all of the above, but I would NOT expect it to match

```
:ss

```

While it is not critical for me to NOT match the last `:ss` I wonder: Why does it match the last (and how would you suggest I modify my regexp for it to exclude that case)?