有什么想法为什么这个 preg_match 可以在 PHP7.2 上运行但在 7.3+ 上失败?
$word = 'umweltfreundilch'; //real life example :/
preg_match('/^(?U)(.*(?:[aeiouyäöü])(?:[^aeiouyäöü]))(?X)(.*)$/u', $word, $matches);
var_dump($matches);
Run Code Online (Sandbox Code Playgroud)
警告:preg_match():编译失败:(? 或 (?-
PHP 7.2 及以下输出:
array(3) {
[0]=>
string(16) "umweltfreundilch"
[1]=>
string(2) "um"
[2]=>
string(14) "weltfreundilch"
}
Run Code Online (Sandbox Code Playgroud)
正则表达式似乎没问题,不是吗?
https://regex101.com/r/LGdhaM/1