preg_replace with curly brackets
I'd like to replace the string "{{edit(3)}}"
with "open3close"
using pre开发者_运维百科g_replace
Escape {
and }
to \{
and \}
in regex string
I'm sorry if you wasted your time, i found a valid solution.
preg_replace("/{{edit\((.*)\)}}/e","'open'.'\\\1'.'close'", $string);
input : {{edit(3)}}
output: open3close
精彩评论