I have a question about Regex pattern for removing comments from XML document. I have two kinds of comments:
single line
and multiline.
For removing comments I used next code:
processedContent = File.ReadAllText(xml);
Regex regex = new Regex(@"<!--(\n|.)*-->\r\n");
processedContent = regex.Replace(processedContent, "");
It works fine for the multiline XML comment but for the single line comment all nodes between comments are removed also and I have such an output for the first sample:
Any help about correct "universal" Regex pattern for such cases?