Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/273.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何克服预赛';偏移量大于主题长度';?_Php_Regex_Preg Match_Regex Lookarounds - Fatal编程技术网

Php 如何克服预赛';偏移量大于主题长度';?

Php 如何克服预赛';偏移量大于主题长度';?,php,regex,preg-match,regex-lookarounds,Php,Regex,Preg Match,Regex Lookarounds,在www.test.com/this/works/12345678901234567/2009/08/2009819107554384978.html上,模式~(\w+-?)+[0-9]+(?=\.html)~返回false 但在www.test.com/this/works/12345678901234567/2009/08/200981910755438497.html上返回1(少一个字符) PHP文档内容如下: '如果偏移量大于主题长度,则返回FALSE。' 怎么会这样 .这是由于灾难性的

www.test.com/this/works/12345678901234567/2009/08/2009819107554384978.html上,模式
~(\w+-?)+[0-9]+(?=\.html)~
返回false

但在
www.test.com/this/works/12345678901234567/2009/08/200981910755438497.html
上返回1(少一个字符)

PHP文档内容如下:

'如果偏移量大于主题长度,则返回FALSE。'

怎么会这样


.

这是由于灾难性的回溯。使用。我仍然不清楚这是否是一个可修复的语法问题(如果是,如何解决),或者我是否必须重新考虑正则表达式。尽管它在贪婪性方面存在问题,但我无法复制。请检查这里:现在您更改了输入。若你们阅读第二个重复的标记问题,你们会发现一些有用的信息。