$text = '<span class="STYLE1"><p> <span style="display:none">JfW《今日肇庆》对外宣传政府网</span></p>  <p align="center"><img border="0" alt="" src="http://www.zq.net.cn/d/file/News/yaowen/2012-06-10/d9c70.jpg" />';
$text = stripslashes($text);
//print_r($text);
$pregfind = array(
"/<img([^>]*file[^>]*)>/eiU",
);
$pregreplace = array(
"img_tag('\\1', '".$url."')",
);
return preg_replace($pregfind, $pregreplace, $text);一直不明白,我想匹配的是
<img file="http://bbs.942dn.com/static/image/common/back.gif" onload="thumbImg(this)" alt="" />
这样的图片,但是上面例子中图片没有file属性,为何正则也匹配到他了?求解。怎么修改正则才只匹配到<img file="http://bbs.942dn.com/static/image/common/back.gif" onload="thumbImg(this)" alt="" />
而不要匹配到<img border="0" alt="" src="http://www.zq.net.cn/d/file/News/yaowen/2012-06-10/d9c70.jpg" />