For this PHP page I know that \P{C}
matches all non-invisible control characters. And I try the pattern [\P{C}]*
in this regex test site, it does match the Chinese characters.
In my PHP 5.6.30 hosted on Apache
preg_match_all('#([\P{C}]*)#', '中文', $t_matches, PREG_SET_ORDER);
var_dump($t_matches);
does not match the Chinese characters correctly. But the following code does:
preg_match_all('#([^\n]*)#', '中文', $t_matches, PREG_SET_ORDER);
var_dump($t_matches);
I know how to correctly match Chinese character from this post. I am just wondering why the [\P{C}]*
failed.