ホームページ  >  記事  >  バックエンド開発  >  正则表达式 - php正则问题

正则表达式 - php正则问题

WBOY
WBOYオリジナル
2016-06-06 20:24:121300ブラウズ

<code>   preg_match("/(?).*?(?=)/", $html, $result);</code>

报错
preg_match(): Compilation failed: lookbehind assertion is not fixed length at offset 24
是为啥呢?
就是\s*那里,php的正则不是这样写嘛?

回复内容:

<code>   preg_match("/(?).*?(?=)/", $html, $result);</code>

报错
preg_match(): Compilation failed: lookbehind assertion is not fixed length at offset 24
是为啥呢?
就是\s*那里,php的正则不是这样写嘛?

后瞻断言的内容被严格限制为只能用于匹配定长字符串。

http://php.net/manual/zh/regexp.reference.assertions.php

声明:
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。