当前位置: 代码迷 >> ASP.NET >> 过滤script标记,该怎么解决
  详细解决方案

过滤script标记,该怎么解决

热度:6600   发布时间:2013-02-25 00:00:00.0
过滤script标记
问题:在一段代码中,如下
  <script> </script> 这是一个测试内容 <script> </script>
中的script脚本代码过滤掉,只留下 "这是一个测试内容 ",而不是将全部内容删除掉.

------解决方案--------------------------------------------------------

result = System.Text.RegularExpressions.Regex.Replace(result, @ " <script[^> ]*> [\s\S]*? </script> ", " ", RegexOptions.IgnoreCase);

更多请浏览 http://www.51aspx.com
  相关解决方案