A time string containing minutes and/or seconds looks like this
29m 15s
The delimiter is a single space. The numbers have no leading zeroes. Either the minutes or the seconds part (but not both) can be omitted. If one of them is missing, so is the delimiter. That is, the following are all valid examples of such time strings:
1m
47s
1m 15s
12m 4s
I need to construct a regular expression that would return in $1 and $2 the number of minutes and seconds respectively. I'm writing a JavaScript program, but it's constructing the regular expression that I have a problem with - not the actual programming.