I want to capture Integer in between certain string.
My Regular Expression String is
re_str = "HOWMUCH?*\s*_*\s*(\s*(\d+)\s*)_*\s*USD"
target_text = " 1. HOWMUCH?__10_ USD
1. HOWMUCH?_20_USD
1. HOWMUCH?30__ USD
1. HOWMUCH?__40___ USD
1. HOWMUCH? 50 USD
1. HOWMUCH? __60___USD"
# I need to capture all int: 10, 20, 30 ... 60
Works well in here: regex101
I have tried re.findall
m = re.findall(r'{}'.format(re_str), target_text)
m: [('20', '20')]
also tried re.search
, got the same results.
python repl
Environment: Python2.7
SOLVED
I modified RegExp to HOWMUCH?*[\s]*[_]*[\s]*(\s*(\d+)\s*)[_]*[\s]*USD
then it works !