日期:2014-05-17  浏览次数:20936 次

正则,如果img标签里没有alt,则加上alt=""
正则,如果img标签里没有alt,则加上alt= " "

<img   src= "asdfas.gif "   width= " "         heigth= " "   alt= "dsafa ">
-->
<img   src= "asdfas.gif "   width= " "         heigth= " "   alt= "dsafa ">

<img   src= "asdfas.gif "   width= " "         heigth= " ">
-->
<img   src= "asdfas.gif "   width= " "         heigth= " "   alt= "dsafa ">

意思就是,有的话不管,没有则加上一个


------解决方案--------------------
DC关注
------解决方案--------------------
( <img(?![^\x3E]*?alt[^\x3E]*?> ).*?)> 
可以吗?
------解决方案--------------------
jf