I have a python string:
s = 'filename 13.00 50850.8732503344475 37.11 abc'
In order to find the second string with format nn.nn, I know I can do:
re.findall(r'.*(\b\d+\.\d+)',s)[0]
which finds:
'37.11'
But I want to replace it with 99.99.
I tried:
re.sub(r'.*(\b\d+\.\d+)','99.99',s)
But that just yields:
'99.99 abc'
whereas I want:
'filename 13.00 50850.8732503344475 99.99 abc'
Clearly I don't yet understand how regex works. Could someone offer help please?