Home > Backend Development > PHP Tutorial > Solving the problem of preg_match long string matching failure in PHP_PHP tutorial

Solving the problem of preg_match long string matching failure in PHP_PHP tutorial

WBOY
Release: 2016-07-13 10:55:59
Original
1046 people have browsed it

The article introduces a problem often encountered in PHP development. Preg_match fails to match long strings. Students who have encountered the same problem can refer to it.

The string is relatively long, so I wonder if preg_match also has a string length limit, and sure enough!
This will happen with preg_match and preg_match_all.

Solution:
1. ini_set(‘pcre.backtrack_limit’, 1000000); //The default is only 100000
2. Modify the pcre.backtrack_limit parameter of php.ini to support larger strings. Add configuration: pcre.backtrack_limit=-1

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/632207.htmlTechArticleThe article introduces a problem often encountered in PHP development. preg_match fails to match long strings. Others have encountered the same problem. Students who have questions can refer to it. The string is relatively long, so I wonder if it is...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template