This article mainly introduces the string length problem of regular expression matching in the preg_match function in PHP. if you also encounter the problem that the preg_match regular expression is always blank or cannot be extracted, this problem may be encountered. if you need it, you can use preg_match to extract the target content from the project. if there is a problem, the code will 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: ini_set ('pcre. backtrack_limit ', 999999999 );
Note: this parameter is available after php 5.2.0.
For more information, see 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 restrict: ini_set ('pcre. recursion_limit ', 99999 );
In actual project applications, it is best to set the memory limit: ini_set ('memory _ limit ', '64m');, which makes it safer.