2

/u modifier is used in PCRE when we use unicode characters like /x{0xFF0}.

Does it cause any problem if we have a regex like /^\d{10}$/u (e.g. using unicode modifier when unicode is not used in regex) ? I ask this because I get different results in localhost and production server(using preg_match function)

And if it doesn't cause any problem, why this modifier is not used by default?

4

1 回答 1

1

它不会引起任何问题,因为 ascii 字符是 utf-8 的一部分,只是要小心,因为“u”修饰符取决于使用 --enable-utf8 编译的 PCRE。

于 2013-09-18T17:00:47.160 回答