I need to replace all the dots (.) to "[DOT]" available in the html tags and not in the outside of the tags. i.e. attribute value which contains dot (.) should be replace as "[DOT]" but not inner text.
example tag
<link rel="stylesheet" href="27674557W.patent.001_files/27674557W.patent.001.css" type="text/css"/>
changes should be like:
<link rel="stylesheet" href="27674557W[DOT]patent[DOT]001_files/27674557W[DOT]patent[DOT]001[DOT]css" type="text/css"/>
I have tried this patterns in regex.
<(?:[^\.>]*)([\.])(?:[^>]*)>
Replacing code in c# is:
string inputText = <tagText>;
string pattern = @"<([^\.>]*)([\.])([^>]*)>";
inputText = Regex.Replace(inputText, pattern, "$1[DOT]$3", RegexOptions.Singleline);
The above code only replace the first dot in the tab, remaining dots are not changing. I need to change in single shot without using any loop in c#.
Note: Only to replace inside the angle bracket. Not in innertext.
Thanks.