Here is my code:
$long = str_repeat('a very long string text', 100);
$str = <<<STR
<abc>a short string text</abc>
<abc>$long</abc>
STR;
preg_match_all('@<abc>([^<>]+)</abc>@sU', $str, $matched);
print_r($matched);
And it works fully as expected. However, after you change 100 reps to 5000, run
print_r($matched);
And you only get results for a short line.
My question is how to get preg_match or preg_match_all to work with large text texts (1 MB or more)?
source
share