Say I have text 'C:\somedir\test.log' and I want to replace 'somedir' with 'somedir\logs'.
So I want to go from 'C:\somedir\test.log' to 'C:\somedir\logs\test.log'
How do I do this using the re library and re.sub?
I've tried this so far:
find = r'(C:\\somedir)\\.*?\.log'
repl = r'C:\\somedir\\logs'
print re.sub(find,repl,r'random text ... C:\somedir\test.log more \nrandom \ntext C:\somedir\test.xls...')
But I just get 'C:\somedir\logs'