How to use a regular expression to represent Chinese and a few connections to learning regular expressions and

xiaoxiao2021-03-06  74

http://hedong.3322.org/archives/000309.html http://hedong.3322.org/rchives/Regular Expressions/ How to use regular expressions 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-107468.html

New Post(0)