What does a regular expression mean: $ con = preg_replace ('/shop_rate_list (.)/S',' $ 1', $ con); solution

Source: Internet
Author: User
What does a regular expression mean: $ conpreg_replace (shop_rate_list ((. *) s, $1, $ con); preg_replace (shop_rate_list ((. *) s, $1, $ con); & nbsp; find the detailed explanation of the regular expression ------ solution ------------------ preg_replac what does a regular expression mean: $ con = preg_replace ('/shop_rate_list \((. *) \)/S', '$ 1', $ con );
Preg_replace ('/shop_rate_list \ (. *) \)/S',' $ 1', $ con );

Detailed explanation of this regular expression

------ Solution --------------------
Preg_replace ('/shop_rate_list \ (. *) \)/S',' $ 1', $ con );

1)
'/Shop_rate_list \ (. *) \)/s'
/And/s
Start and end. adding s is case insensitive.
Shop_rate) list \(
Because () is a special symbol, \ (\) conversion is required.
(. *) All content.

2)
'$ 1' can be interpreted as a variable to obtain the content in the 1st appearance () of a regular expression.
If 1st times () appears, then $1 2nd times, then $2 and so on.
Therefore, it means to get shop_rate_list \ (. *) \), and $1 gets the content in () in shop_rate_list ().

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.