img标记的正则表达式

aa323 2012-06-27 02:16:07
上次在网上发帖求助过,结果碰到类似这样的就无法处理:
<IMG onclick="if(this.width>screen.width-461) window.open('http://photo4.zxip.com/folder18/14184/20110102135517/201113161621440.jpg');" border=0 alt="" src="http://photo4.zxip.com/folder18/14184/20110102135517/201113161621440.jpg">
请高人指点,谢谢!!
...全文
108 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
aa323 2012-07-11
  • 打赏
  • 举报
回复
自己顶起来
aa323 2012-07-03
  • 打赏
  • 举报
回复

Chinajiyong 怎么又报错 字符串未结束啊?
EnForGrass 2012-06-28
  • 打赏
  • 举报
回复
(?i)<IMG\s*[^<]*?src="[^""]*?"[^>]*?/?>

注意引号转义
aa323 2012-06-28
  • 打赏
  • 举报
回复
Chinajiyong 是不是双引号有问题?

ChinaXtHuLang 就是想过滤掉图片,去掉<img> , <img/>标记,不管标记里面是不是有 onclick="if(this.width>screen.width-461) window.open 之类的东西,都过滤掉
aa323 2012-06-28
  • 打赏
  • 举报
回复
Chinajiyong 是不是双引号有问题?

ChinaXtHuLang 就是想过滤掉图片,去掉<img> , <img/>标记,不管标记里面是不是有 onclick="if(this.width>screen.width-461) window.open 之类的东西,都过滤掉
EnForGrass 2012-06-27
  • 打赏
  • 举报
回复
/<IMG\s*[^<]*?src="[^"]*?"[^>]*?>/gi
ChinaXtHuLang 2012-06-27
  • 打赏
  • 举报
回复
你想要的结果是什么?
aa323 2012-06-27
  • 打赏
  • 举报
回复
就是标题上说的 匹配html中img标记哦,将图片都过滤掉,结果碰到:
<IMG onclick="if(this.width>screen.width-461) window.open('http://photo4.zxip.com/folder18/14184/20110102135517/201113161621440.jpg');" border=0 alt="" src="http://photo4.zxip.com/folder18/14184/20110102135517/201113161621440.jpg">

出现问题了
三石-gary 2012-06-27
  • 打赏
  • 举报
回复
你说的什么啊。。把问题描述清楚。。

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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