Hi everybody. I am new at this so I'm struggling a bit in changing a repeated string throughout a text file.


I'd like to replace this kind of string (repeated through the text, where "myVar", myWord and myNumber take different values):


myFunction("myVar",myWord,30,myNumber)


for this one:


myFunction("myVar",myNumber,30,myWord)



So I simply changed the order for the myFunction input parameters.



My questions are:
1) How do I loop through a text document and find each instance of the first string?
2) How do I modify that string?


I was thinking in a loop through the file searching for the string "myFunc(", and when this is found, get the text between the two first commas and replace it by the text between the last comma and the last bracket, but I don't know how to do it...


If anyone has some idea I'd appreciate it.


Thanks!!