Q:

Capturing numbers with space between digits and removing that space

This might be a silly question but I can't find a nice way to solve it.
I want to capture numbers in some strings that contains a white space between every group of 3 digits. For example "45 000 €". 
I can capture the numbers easily with some regex operation but I do not manage to directly remove the white space, i.e I get "45 000" instead of "45000". 
import re
digits = re.findall(r"(\d+\s?\d*)", "Salary between 35 000 € and 45 000 €")
print(digits)

Returns :
['35 000', '45 000']

While I directly want:
['35000', '45000']

Of course after that I could use list comprehension to remove the white space for every number but there should be a more direct solution with regex, isn't it ? I tried to play around with non capturing group or look around but with no success (either the white space stay, or the numbers are truncated in two).
Thx for your help

A:

This expression might likely do that:
(?<=\d)\s+(?=\d)

with a re.sub, then we'd perform a simple re.findall.
import re

test_str = "Salary between 35 000 € and 45 000 € 35 000 000    0 0 0 €"

print(re.findall(r"(\d+)", re.sub(r"(?<=\d)\s+(?=\d)", "", test_str)))

Output
['35000', '45000', '35000000000']

The expression is explained on the top right panel of this demo if you wish to explore/simplify/modify it. 

