2011-05-22 86 views
2

道歉为另一个preg_replace问题!PHP 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); 

我已经通过一对夫妇网上正则表达式的建设者运行正则表达式,似乎声音。任何想法,我在这里失踪?我错误地使用]

回答

5

你需要在你的表达分隔符:

$newContent = preg_replace('|<img [^>]*.gif[^>]*?>|','MATCHED',$newContent); 
+0

良好,即工作一种享受。非常感谢本杰明。 – lexnels 2011-05-23 08:52:43

相关问题