How to use a regular expression to represented Chinese?

zhaozj2021-02-16  62

How to use a regular expression to represented Chinese?

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-21772.html

New Post(0)