This function with minor settings should work: -
private string RemoveHTMLComments(string input) { string output = string.Empty; string[] temp = System.Text.RegularExpressions.Regex.Split(input, "<!--"); foreach (string s in temp) { string str = string.Empty; if (!s.Contains("-->")) { str = s; } else { str = s.Substring(s.IndexOf("-->") + 3); } if (str.Trim() != string.Empty) { output = output + str.Trim(); } } return output; }
Not sure if this is the best solution ...
Ankush roy
source share