java正则表达式问题

cooc123 2008-02-24 02:51:53
String pstr = "(<br /><div class=\"tpc_content\">|<iframe\\s(.+?)</iframe>|onclick(.+?)style='cursor:pointer'><br>|";
pstr = pstr + "<span style='font-size:1px'> </span>|<a target=\"_blank\" onmouseover(.+?)torrent.gif' align='absmiddle'>)";
p = Pattern.compile(pstr,Pattern.CASE_INSENSITIVE); //启用大小写
m = p.matcher(url);
while(m.find()) {
url = url.replace(m.group(), "");
}
System.out.println(url);

为什么对<IFRAME </IFRAME>匹配不到呢
...全文
294 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
cooc123 2008-02-24
  • 打赏
  • 举报
回复
还是没匹配到呀

原<br /><div class="tpc_content"><a href='http://drlee.yi.org/to/?aHR0cDovL3d3dy5oMDkzMC5jb20vc2FtcGxlZy9nb2xkLzAzNy9pbmRleC5odG1s&z' target='_blank'>點擊這里打開新視窗</a><br><IFRAME SRC='http://www.h0930.com/sampleg/gold/037/index.html' FRAMEBORDER=0 ALLOWTRANSPARENCY=true SCROLLING=YES WIDTH=100% HEIGHT=500></IFRAME><br><img src='http://www.enregistrersous.com/images2/2687256320080214105341.jpg' onclick="window.open('http://drlee.yi.org/to/?aHR0cDovL3d3dy5lbnJlZ2lzdHJlcnNvdXMuY29tL2ltYWdlczIvMjY4NzI1NjMyMDA4MDIxNDEwNTM0MS5qcGc=&z');return false;" style='cursor:pointer'>

新<br><IFRAME SRC='http://www.h0930.com/sampleg/gold/037/index.html' FRAMEBORDER=0 ALLOWTRANSPARENCY=true SCROLLING=YES WIDTH=100% HEIGHT=500></IFRAME><br><img src='http://www.enregistrersous.com/images2/2687256320080214105341.jpg'建立连接.......
老紫竹 2008-02-24
  • 打赏
  • 举报
回复
String pstr ="<iframe\\s*(.*?)></iframe>";
这个足以

62,623

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧