首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > J2SE开发 >

求与网页相关的正则表达式,该怎么处理

2012-01-29 
求与网页相关的正则表达式我想把下载到的网页源代码里面的 script/script 标记,hrefjavascript:( a

求与网页相关的正则表达式
我想把下载到的网页源代码里面的 <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>

热点排行