How to use a regular expression to represent Chinese

xiaoxiao2021-03-06  39

Since the Chinese ASCII code has a certain range. So you can represented Chinese with the following regular expressions. / ^ [CHR (0xA1) -chr (0xFF)] $ / below is an example of use: $ Str = "Beyond PHP"; if (preg_match ("/ ^ [". chr (0xa1). "-". CHR (0xFF). "] $ /", $ STR)) {echo "This is a pure Chinese string";} else {echo "This is not a pure Chinese string";

转载请注明原文地址:https://www.9cbs.com/read-78835.html

New Post(0)