相关疑难解决方法(0)

RegEx 从 PHP 7.4 开始失败,在 7.3 中工作

有什么想法为什么这个 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

php regex preg-match

6
推荐指数
1
解决办法
991
查看次数

标签 统计

php ×1

preg-match ×1

regex ×1