I am trying to replace path in given text file. I am using regular expression for that.
filePath = txtFilePath.Text;
oldPath = txtOld.Text;
newPath = txtNew.Text;
string output = File.ReadAllText(filePath);
output = Regex.Replace(output, oldValue, newValue, RegexOptions.IgnoreCase);
File.WriteAllText(filePath, output);
I have tried oldPath.Replace(@"\\", @"\") also but now use.It throwing an exception like unrecognised escape sequence. Please let me know the solutions.

Upendra Pratap ShahiPosted Jul 17, 2015, 7:19 AM
SIVAPosted Jul 17, 2015, 5:25 AM
Raja TPosted Jul 17, 2015, 2:59 AM
Try this code
or use the @ symbol
Abrar Ahmad AnsariPosted Jul 17, 2015, 2:51 AM