日期:2014-05-20  浏览次数:20662 次

求与网页相关的正则表达式
我想把下载到的网页源代码里面的 <script> </script> 标记   ,href=javascript:   ( <a> )   属性   ,
控件的on...事件   ,
frame   iframe   frameset都去掉。
所以需要在String.replaceAll函数里用到正则表达式,希望大家帮我想想。


------解决方案--------------------
大过年的都HAPPY去了,开年再说吧!
------解决方案--------------------
我想把下载到的网页源代码里面的 <script> </script> 标记 ,href=javascript: ( <a> ) 属性 ,
控件的on...事件 ,
frame iframe frameset都去掉。
1. <script> </script> --------------> (\\ <script\\> [^\\ <]*\\ <\\/script\\> )
2.href= "javascript: "---------------> \\ <a\s(href\\=\\ "javascript\\:[^\\ "]+\\ ")[^\\> ]+\\>
3.frame iframe frameset都去掉。(\\ <frame[^\\> ]+\\> |\\ <iframe[^\\> ]+\\> |\\ <frameset[^\\> ]+\\> )
------解决方案--------------------
楼上的测试 <script> this is a " < " test </script> 一下会有问题的,其余类似...
给个简洁点的 <(script)> .*? <\/\1> 其余类似...
------解决方案--------------------
modify:)
(?s) <(script)> .*? <\/\1>