In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article will explain in detail the example analysis of regular expression efficiency greed, non-greed and backtracking in PHP. The editor thinks it is very practical, so I share it with you for reference. I hope you can get something after reading this article.
If a student wants to filter the content between them, that's how he writes the rules and procedures.
$str = preg_replace ('%. +?% iPrecious and not greedy).
It seems that there is no problem, but in fact it is not. If
$str = 'alert ([xss_clean])'
Then after the above program processing, the result is
$str = 'alert ([xss_clean])'; $str = preg_replace ('%. +?); / / non-greedy print_r ($str); / / $str output to alert ([xss_clean])
Still can't get the effect he wants. The above is not greedy, but also called inertia. Its non-greedy logo is followed by a quantifier metacharacter, such as +, *,? (quite special, I will write about it in the future BLOG), etc. That is, the logo is not greedy, if not written? Is greed. such as
$str = 'alert ([xss_clean])'; $str = preg_replace ('%. +% iGray print_r ($str); / / $str output is
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.