What is the placeholder written in the regular expression of PHP, and is there more information?
For example:
$a='{$name}'; $_patten='/\{\$([\w]+)\}/';//匹配模板中的{变量} //模板内容替换后付给$this->_tpl $tpl=preg_replace($_patten,"\\1".'
',$a); echo $tpl;这里面的\\1也可以换成$1,代表正则表达式第一个()匹配的内容
Reply content:
What is the placeholder written in the regular expression of PHP, and is there more information?
For example:
$a='{$name}'; $_patten='/\{\$([\w]+)\}/';//匹配模板中的{变量} //模板内容替换后付给$this->_tpl $tpl=preg_replace($_patten,"\\1".'
',$a); echo $tpl;这里面的\\1也可以换成$1,代表正则表达式第一个()匹配的内容
I don't know if you're asking. The rule of the regular expression or the placeholder for the match result, the placeholder for the matching result is the format of the \\1 \\2 \\3.
The first mistake, is the use of all the placeholders inside the regular expression, I can't find the information ~ ~ Woo ...