为另一个preg_replace问题道歉!
我收到了错误:
Warning: preg_replace() [function.preg-replace]: Unknown modifier ']' in C:\xampp\htdocs\reg.php on line 6
运行以下preg_replace时:
$newContent = preg_replace('<img [^>]*.gif[^>]*?>','MATCHED',$newContent);
我通过几个在线正则表达式构建器运行正则表达式,看起来很合理。我在这里缺少什么想法?我错误地使用]
吗?
答案 0 :(得分:5)
你的表达需要一个分隔符:
$newContent = preg_replace('|<img [^>]*.gif[^>]*?>|','MATCHED',$newContent);