I wanted to match the numeric values โโof the string:
1,000 metric tonnes per contract month Five cents ($0.05) per tonne Five cents ($0.05) per tonne 1,000 metric tonnes per contract month
My current approach:
size = re.findall(r'(\d+(,?\d*).*?)', my_string)
What I get with my approach:
print size [(u'1,000', u',000')]
As you can see, number 1 cut out from the second element of the list, why? Also, can I get a hint on how I can match the terms $0.05 ?
source share