Using Regex in Python (library re (only)), I want to create a function that gives me the position of all leading 0s in a string.
For example, if the string was: My house has 01 garden and 003 rooms. I would want me the function to return 13, 27 and 28.
I tried for example:
import re
string = "My house has 01 garden and 003 rooms."
pattern = "(0+)[1-9]\d*"
print(re.findall(pattern,string))
Obviously, the output gives me the matches but no position...