regex – Regular expression, getting numbers before a text


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?


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)


Scroll to Top