What is the placeholder's writing format in a regular expression in PHP

Source: Internet
Author: User
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 ...

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.