I'm trying to catch all numbers from a string using Python regex. By numbers I mean integers and floats (using ,
or .
).
I managed to get it done using this regex : ([0-9]+[\,|\.][0-9]+|[0-9]+)
But I have a problem, I need it to match big numbers with spaces in them. I mean 20 000
or 5 000 000
. And these numbers can be very big with a lot of spaces. I don't know how much. But there will always be 1 space between numbers, no more. For example: 20 30
= this will be 2 differents numbers.
I guess I will need some sort of recursive pattern (?R)
, but I don't know how to use it.
Can someone help ? :)