//过滤文件中的所有标记和 script Style.

来源:互联网 发布:齐次矩阵是什么 编辑:程序博客网 时间:2024/05/16 11:33

/*//过滤文件中的所有<>标记和 script <>Style.

public static string striphtml(string strhtml)
  {
   string stroutput = strhtml;
   Regex regex = new Regex(@"<[^>]+>|</[^>]+>");
   stroutput = Regex.Replace(stroutput, "(<script)[//s//S]*?(</script>)|(<style)[//s//S]*?(</style>)", " ", RegexOptions.IgnoreCase);
   stroutput = regex.Replace(stroutput, "");
   return stroutput;
  }

*/

原创粉丝点击