相关疑难解决方法(0)

[az]是否会匹配PREG/PCRE中的重音字符?

我已经知道\w在PCRE中(特别是PHP的实现)有时可以匹配一些非ASCII字符,具体取决于系统的语言环境,但是呢[a-z]

我不这么认为,但我注意到Drupal的核心文件之一中的这些行(包括/ theme.inc,简化):

// To avoid illegal characters in the class,
// we're removing everything disallowed. We are not using 'a-z' as that might leave
// in certain international characters (e.g. German umlauts).
$body_classes[] = preg_replace('![^abcdefghijklmnopqrstuvwxyz0-9-_]+!s', '', $class);
Run Code Online (Sandbox Code Playgroud)

这是真的吗,还是只是有人[a-z]混淆了\w

php regex ascii pcre

17
推荐指数
3
解决办法
2220
查看次数

标签 统计

ascii ×1

pcre ×1

php ×1

regex ×1