Sorry if someone already posted the same question, but I was unable to find it.
I am trying to replace certain occurrences of a string pattern with something else. The problem I do not want to replace all occurrences, just all apart from one.
For example.
Imagine I have the string: '(M:2,Seq0:2):10,Seq1:20,(Seq2:40,Seq3:40)'
The pattern I want to find is: '\w+\d+:\d' (which refer to Seq[number])
Imagine I want to change all numbers after 'Seq[number]:'
but not the one following for example, 'Seq1:'
Imagine that to all these numbers after Seq[number]: I wanna sum the value of 10
in The end I would like to have the string:
'(M:2,Seq0:12):10,Seq1:20,(Seq2:50,Seq3:50)'
Is there a way of doing this in a loop? I tried to use re.findall, but it returns all occurences in a text. How could I incorporate this in a loop?
Thanks!