试了这个:new Regex(@"<script.*?>(.*?) </script>", RegexOptions.ExplicitCapture| RegexOptions.Multiline| RegexOptions.IgnoreCase);
用这个页面做测试http://www.ce.cn/xwzx/gjss/gdxw/200807/13/t20080713_16139821.shtml
只去除了第一个
求一个牛X的正则
------解决方案--------------------------------------------------------
- C# code
string ss = "<script alsdf>***lsdkjf </script>aaa<script >"; Regex reg = new Regex("<.*?script.*?>", RegexOptions.IgnoreCase); Match m = reg.Match(ss); while (m.Success) { ss = reg.Replace(ss, "[script]"); m = m.NextMatch(); } Console.Write(ss);
------解决方案--------------------------------------------------------
new Regex(@"<script.*?>(.*?)</script>", RegexOptions.Multiline | RegexOptions.IgnoreCase);
这样可以