Php – regular expression to check if the string has chinese chars

You could use a unicode character class http://www.regular-expressions.info/unicode.html

preg_match("/\p{Han}+/u", $utf8_str);

This just checks for the presence of at least one chinese character. You might want to expand on this if you want to match the complete string.

Leave a Comment

tech