I'm trying to change:
'1foo 1.5f/b 1 Foo Bar'
to:
"1fb 1.5fb 1fb"
this is my code:
re.sub(r"(?i)\b(\d+\.*\d*)\s*(f\/b|foo|foo bar)\b",r"\1fb",'1foo 1.5f/b 1 Foo Bar')
but what I get is:
'1fb 1.5fb 1fb Bar'
This is because both foo and foo bar are in the match group. How can I avoid Bar being in the output?
Thanks in advance