I got a problem when I tried to find some characters with following code:
$str = "统计类型目前分为0日Q统计,月统q计及287年7统1计三7种,如需63自定义时间段,点1击此hell处进入自o定w义统or计d!页面。其他统计:客服工作量统计 | 本周服务统计EXCEL";
preg_match_all('/[\w\uFF10-\uFF19\uFF21-\uFF3A\uFF41-\uFF5A]/',$str,$match); //line 5
print_r($match);
And I got error as below:
Warning: preg_match_all() [function.preg-match-all]: Compilation failed: PCRE does not support \L, \l, \N, \U, or \u at offset 4 in E:\mycake\app\webroot\re.php on line 5
I’m not so familiar with reg expression and have no idea about this error.How can I fix this?Thanks.
The problem is, that the PCRE regular expression engine does not understand the
\uXXXX-syntax to denote characters via their unicode codepoints. Instead the PCRE engine uses a\x{XXXX}-syntax combined with theu-modifier:See my answer here for some more information.
EDIT:
You’re sure, that you used the
u-modifier (see arrow above)? If so, you’d have to check if your PHP supports thu-modifier at all (PHP > 4.1.0 on Unix and > 4.2.3 on Windows).