简体   繁体   中英

PHP preg match all limit 3725 characters

how to increase search character limit? now in example is 3276 characters but in 3275 its works ok

ini_set("pcre.backtrack_limit", "23001337");
ini_set("pcre.recursion_limit", "23001337");

$str = "<div>";
for ($x=1;$x<=327;$x++){
    $str .= "1234567890";
}
$str .="123456";
$str .= "</div>";

$w1 = "/<div>((.*?|\n)*)<\/div>/";
preg_match_all($w1, $str, $matches);
print_r($matches);

Try disabling pcre.jit (don't use PCRE's just-in-time compilation):

<?php
ini_set("pcre.jit", "0");

$str = "<div>";
for ($x=1;$x<=327;$x++){
    $str .= "1234567890";
}
$str .="123456";
$str .= "</div>";

$w1 = "/<div>((.*?|\n)*)<\/div>/";
preg_match_all($w1, $str, $matches);
print_r($matches);
?>

You should execute preg_last_error() to know what has failed.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM