Question:
I wanted a regular expression to get the minutes in a string with this format:
1 min
10 min
I made that expression. \d(?= min)
Problem is, it only gets the last number, closest to the min. How would I get all the numbers?
Answer:
If you add a +
after \d
it works. In this way it means a number that occurs one or more times . Being without the +
means only once .
\d+(?= min)
Example: http://regexr.com/3bmpn