I'm using preg_match_all for very long pattern.
when run the code, i got this error :
Warning: preg_match_all(): Compilation failed: regular expression is too large at offset 707830
After searching, I got the solution, so I should increase value of pcre.backtrack_limit
and pcre.recursion_limit
in php.ini
But after I increase the value and restart my apache, it still got the same problem. My PHP verison is 5.3.8
That error is not about the performance of the regex, it's about the regex itself. Changing the pcre.backtrack_limit
and pcre.recursion_limit
isn't going to have any effect because the regex never gets a chance to run. The problem is that the regex is too big, and the solution is to make the regex smaller--much, much smaller.