注释的正则:<!--[\s\S]*?-->
页面样式的正则:<style[^>]*>[^<]*?</style>
HTML标签的正则:<[^>]*?>
/// <summary>
/// 正则替换
/// </summary>
/// <param name="sOld">原内容</param>
/// <param name="sRegexString">正则表达式</param>
/// <param name="sReplaceString">新字符串</param>
/// <returns></returns>
public static string ReplaceRegxString(string sOld, string sRegexString, string sReplaceString)
{
Regex reg = new Regex(@sRegexString, RegexOptions.Singleline | RegexOptions.IgnoreCase);
return reg.Replace(sOld, sReplaceString);
}
参考资料:http://hi.baidu.com/activezfj/blog/item/4aca3c7a5348f3eb2f73b3b2.html