正则表达式提取图片路径 并过滤掉指定字符的写法

  我想对 html 的图片进行提取.

  <img ico src="http://localhost/UCenter/images/noavatar_small.gif" />

  <img src="http://localhost/UCenter/images/noavatar_small.gif" />

  如上地址. 我想全部提取出来 但是包含'ico' 的地址 忽略. 求正则 , 就是有些图片 提取.有些不提取.

  例子: <\s*img\s+[^>]*?src\s*=\s*(\'|\")(.*?)\\1[^>]*?\/?\s*>

  经改进后..

  正确解答如下

  /<img(?:(?!(ico)).)+\/>/