I did a form taking a string for input, but if this string is "T:\", the program take "T:\". So, this string I save in a variable "workShearch".
After this variable uses in:
content = Regex.Replace(content, Regex.Escape(wordSearch), Regex.Escape(wordReplace));
But this line contain an error, because wordSearch in this case is "T:\", and the program trhow me an exception like that:
The error ir parsing "T:\" - illegal \ at end of pattern.
Thanks!
Ou! I have a solution! Is this!
StreamWriter writer = new StreamWriter(filePath, false, Encoding.Default);
writer.Write(content.Replace(wordSearch, wordReplace));
writer.Close();