I have run up against an odd problem. it appears i am reaching some sort of limit with preg_replace while trying to use two matches using php-5.3.3
// works
About PHP not being talkative about its errors, you can use T-Regx library, which always throws an exception:
// didnt work
$pattern_2 = '/START-ONE(.*)STOP-ONE.*START-TWO(.*)STOP-TWO.*/';
$string = 'START-ONE this is head stuff STOP-ONE START-TWO' . str_repeat('x', 959971) . 'STOP-TWO';
try {
pattern($pattern_2)->match($string)->first();
}
catch ($e) {
$m = $e->getMessage();
$m // After invoking preg_match(), preg_last_error() returned PREG_BACKTRACK_LIMIT_ERROR.
}