The string length problem of regular matching of preg_match function in PHP
This article mainly introduces PHP Preg_match function Regular matching string length problem, if you also encountered Preg_match regular extract content is always blank or not extracted, it may be encountered this problem, the need for friends can refer to the next
Project, using Preg_match to extract the target content, dead and alive there is a problem, the code measured very much.
Later suspected that PHP Preg_match has a string length limit, sure enough, found that the value of "Pcre.backtrack_limit" is set by default only 100000.
Workaround: Ini_set (' Pcre.backtrack_limit ', 999999999);
Note: This parameter is available after PHP 5.2.0 version.
Also talk about: Pcre.recursion_limit
Pcre.recursion_limit is the recursive limit of pcre, which, if set to a large value, consumes the available stacks of all processes and eventually causes PHP to crash.
can also be limited by modifying the configuration: Ini_set (' Pcre.recursion_limit ', 99999);
In the actual project application, it is best to also set the memory limit: Ini_set (' memory_limit ', ' 64M '); , so it's more secure.
http://www.bkjia.com/PHPjc/1007650.html www.bkjia.com true http://www.bkjia.com/PHPjc/1007650.html techarticle The string length problem of regular matching of preg_match function in PHP This article mainly introduces the string length problem of preg_match function regular matching in PHP, if you also encounter the Preg_match regular ...