Maximum length of string preg_match_all can match and acquire?

后端 未结 1 1330
谎友^
谎友^ 2021-01-20 04:03

I\'m trying to parse some web pages with preg_match_all() and some of them are quite large as several MBs in size. And one of the regular expressions matches some text strin

1条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-20 04:33

    Set the ini_set('pcre.backtrack_limit', '1048576'); to whatever you want in your script or on your php.ini file for global use. (example is 1mb)

    Credit to: http://www.karlrixon.co.uk/writing/php-regular-expression-fails-silently-on-long-strings/

    0 讨论(0)
提交回复
热议问题