求一过滤正则表达式
求一正则表达式,要过滤html页面上的 <script language= "javascript "> ..... </script>
内容
------解决方案--------------------string str = @ "afddddddddddddddddd
<script language= " "javascript " "> ..... </script>
bbbbbbbbbbbbbbb ";
str = System.Text.RegularExpressions.Regex.Replace(str, @ " <script[^> ]*?> [\s\S]*? </script> ", " ");
Response.Write(Server.HtmlEncode(str));
------解决方案-------------------- <script>
var re;
var ss = document.body.innerHTML;
re = new RegExp(/ <script[^> ]*?> [\s\S]*? <\/script> /gi);
ss = ss.replace(re, " ");
document.all.TextBox1.value = ss;
</script>
------解决方案-------------------- <script language= "javascript ">
<!--
function aaa(str)
{
var re=/ <script[^> ]*?> [\s\S]*? <\/script> /gi;
var result = str.replace(re, " ");
alert(result)
}
//-->
</script>
<FORM name= "frmTest ">
<INPUT TYPE= "text " NAME= "txtStr " value= "afddddddddddddddddd <script language= 'javascript '> ..... </script> bbbbbbbbbbbbbbb ">
<INPUT TYPE=BUTTON value= "aaa " onClick= "aaa(document.frmTest.txtStr.value) ">
</FORM>