我一直在尝试使用正则表达式匹配 HTML 文件中的注释,并通过 C#.net (VS2010) 解决方案完全删除它们。这是评论的样子,
/*This flexibility is not available with most other programming languages. E.g. in Java,
the position for \G is remembered by the Matcher object.
The Matcher is strictly associated with a single regular expression and a single subject
string.*/
我确实尝试过/\*.+\*/
,
str = File.ReadAllText("Test.html");<br />
str = Regex.Replace(str, "/\*.+\*/", "", RegexOptions.Singleline);<br />
File.WriteAllText("Test.html", str);
但他们不适合我。我已经在论坛中关注了一些答案,但仍然没有运气。
我会很感激任何帮助:)
谢谢...