regex - PHP -Multibyte regular expression to remove all but chinese characters...please help -
i trying take utf-8 string looks like:
&q| 艝隭)r墢lq28}徫廵g'y鑽妽踒f
and strip out except chinese characters hex 4e00-9fa5 , keep characters in string. have tried taking line leaves valid characters:
preg_replace('/[^\x20-\x7e]/', '', $str);
to this:
preg_replace('/[^\x4e00-\x9fa5]/u', '', $str);
but outputs nothing....am missing something? not regular expressions
you close!
preg_replace('/[^\x{4e00}-\x{9fa5}]/u', '', $str);
Comments
Post a Comment