/\d*/
means "match 0 or more numbers starting at the beginning of a line."
When you start to start your line, it immediately gets into a non-number and cannot go any further. However, this is considered successful because "0 or more."
You can try "1 or more" through
/\d+/
or you can say that it matches "0 or more" from the end of the line:
/\d*$/
Find everything in Python
In Python, there is a findall() method that returns all parts of the string to which your regular expression matches.
re.findall(r'\d*', 'one to 100')
.match() in JavaScript, returns only the first match, which will be the first element in the above array.
source share