How to match Chinese with regex Jackie included in category Posts 2018-04-06 2024-03-06 56 words One minute Contents A sample of PHP regex code for matching Chinese. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 <?php $str= "中文"; $par = "\x80-\xff"; $par2= chr(0xa1).'-'.chr(0xff); /* *The both of $par and $par2 regx can works well. */ if(preg_match("/^[$par2]*$/",$str)){ echo "\$str is Chinese!"; }else{ echo "\$str is not Chinese!"; } ?> Related Content How to delete/remove a commit from Git