If the preg_match regular expression matches, the system prompts pcre. backtrack_limit. This article introduces the pcre. backtrack_limit solution for the preg_match regular expression matching prompt. if you need it, refer to it. Use the preg_match regular expression to extract the target content. if there is a problem, this article introduces the pcre. backtrack_limit solution for the preg_match regular expression matching prompt. if you need it, please refer to it.
Use the preg_match regular expression to extract the target content. if there is a problem with live or dead content, the code will be tested to survive.
Later, I suspect that PHP's preg_match has a string length limit, and found that the value of "pcre. backtrack_limit" is set to only 100000 by default.
Solution:
The code is as follows: |
|
Ini_set ('pcre. backtrack_limit ', 999999999 ); |
Note: this parameter is available after php 5.2.0.
Also, let's talk about:
Pcre. recursion_limit
Pcre. recursion_limit is the recursive limitation of PCRE. if this item is set to a large value, it will consume the available stacks of all processes and eventually cause PHP to crash.
You can also modify the configuration to limit the memory usage: ini_set ('memory _ limit ', '64m ');, this makes it safer.
The code is as follows: |
|
Ini_set ('pcre. recursion_limit ', 99999 ); |
References for other solutions
The code is as follows: |
|
Pcre. backtrack_limit =-1 |
For more details, see http://www.bKjia. c0m/phper/31/42927 .htm
Bytes. Use the preg_match regular expression to extract the target content. if there is a problem in life or death, substitute...