Php regular expressions match Chinese characters. The article tells you how to use php regular expressions to match Chinese characters. The following describes how to use preg_matchmb_eregi to verify Chinese characters and solve problems in the regular expression process. The article tells you how to use php regular expressions to match Chinese characters. The following describes how to use preg_match mb_eregi to verify Chinese characters and solve problems in the regular expression process.
The article tells you how to use the regular expression in the php Tutorial to match Chinese characters. The following describes how to use preg_match mb_eregi to verify Chinese characters and solve problems in the regular expression process.
Preg_match ("/[a-z] {3, 14}/", $ content, [optional] $ a); this returns a boolean value, $ a returns an array, protect the matched characters against $;
Regular Chinese characters
Echo (mb_eregi ("[x80-xff].", "medium d ")? "Yes": "No"). "Chinese characters ";
Echo (mb_eregi ("^ ([x80-xff].) + $", "Chinese ")? "All Chinese characters ":"");
Let's take a look at all Chinese string functions.
$ Str = "how does php eregi match Chinese characters ";
If (preg_match ("/^ [". chr (0x80). "-". chr (0xff). "] + $/", $ str )){
Echo "this is a pure Chinese string ";
} Else {
Echo "this is not a pure Chinese string ";
}
Preg_match_all ($ pat ,......) And preg_replace ($ pat ,......)......
Preg_match_all ("/(Chinese characters) +/ism", "I am a Chinese character, see what you think of me! ", $ M_a );
After the beginning and end of each encoding's high and low levels, you can naturally write regular expressions and directly use sixteen digits. What are the difficulties? Haha. Note that in php, the sixteen bits use x.
Therefore, we can use this regular expression to determine whether it is a gb2312 Chinese character.
$ Str = "example ";
If (preg_match ("/^ [xb0-xf7] [xa0-xfe] + $/", $ str )){
Print ($ str. "all Chinese characters are true ");
} Else {
Print ($ str. "this tc is not all Chinese characters ");
}
?>
The regular expression matches Chinese characters. The following describes how to use preg_match mb_eregi to verify Chinese characters and solve problems in the regular expression process ....