Please see the code below:
Match match = Regex.Match(doc.OuterXml, "\\b" + l_sOldvalue + "\\b");
if ((match.Success) && (l_bflag))
{
string pattern = "\\b" + l_sOldvalue + "\\b";
string l_sChangexml = Regex.Replace(doc.OuterXml, pattern, l_sNewValue);
doc.LoadXml(l_sChangexml);
}
Here I'm using RegEx Match and Replace, but it replaces the tag names also. For me the tag name should not be replaced.
doc.outerxml --> contains complete xml file
Can any one please solve this?