【发布时间】:2015-09-23 05:06:28
【问题描述】:
我有一个这样的字符串:
(link)there is link1(/link), (link)there is link2(/link)
现在我想设置如下所示的链接:
<a href='there is link1'>there is link1</a>, <a href='there is link2'>there is link2</a>
我尝试使用 preg_replace 但结果出错 (Unknown modifier 'l')
preg_replace("/\(link\).*?\(/link\)/U", "<a href='$1'>$1</a>", $return);
【问题讨论】:
-
你需要转义斜线
-
但我用“\”或?转义了斜线
标签: php regex preg-replace