[a-z] 是否会匹配 PREG/PCRE 中的重音字符?
我已经知道在PCRE(特别是PHP的实现)中,有时可以根据系统的区域设置匹配一些非ASCII字符,但是呢?\w
[a-z]
我不这么认为,但我在Drupal的一个核心文件(include/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);
这是真的,还是有人只是混淆了?[a-z]
\w