PHP Warning: preg_match(): Compilation failed: PCRE does not support \L, \l, \N{name}, \U, or \u at offset %d in %s

2021年10月8日 0 条评论 1.61k 次阅读 0 人点赞

如果要找的字符串中,使用的是中文是 \uxxxx 的形式,在正则中使用 \uxxxx 就会得到这个报错。

  • 如果我们要找的是中文字符串,例如: $pattern = "/\u60a8/" 转变成,$pattern = "/\\\\x{60a8}/u"; 的形式
  • 如果我们要找的字符串,正好是 "\u60a8\u597d" 这种字符串,正则就要写成 $pattern = "/\\\\u60a8\\\\u597d/"

guojia

这个人太懒什么东西都没留下