Then Replace is not for you - either use IndexOf and Substring to replace the data manually, or use a Regex to do a more sophisticated pattern matching and replacement.
From your brief description it is difficult to tell, but if you want to change:
a.set(a_Value, comment= a_Comment', report= 0, format= '%s')
To
Replaced.set(a_Value, comment= a_Comment', report= 0, format= '%s')
Then this might do it:
Regex reg = new Regex("\\w+(?=\\.set)");
string result = reg.Replace(InputText,"Replaced");
But it's difficult to tell from a single example of the input with no output samples.