Php regular expressions in Chinese and English. Php Tutorial: regular expressions in Chinese and English! DOCTYPEhtmlPUBLIC-W3CDTDXHTML1.0TransitionalENwww.w3.orgTRxhtml1DTDxhtml1-transitional.dtdhtmlxmlnswww.w php Tutorial Chinese and English regular expressions
Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd>
Php regular expressions in Chinese and English
Function funcChinese ($ str, $ num1 = '', $ num2 ='') // judge Chinese regular expressions
{
If ($ num1! = ''And $ num2! = ''){
Return (preg_match ("/^ ([x81-xfe] [x40-xfe])
{". $ Num1.", ". $ num2."} $/", $ str ))? True: false;
} Else {
Return (! Eregi ("[^ x80-xff]", "$ str "))?
True: false;
}
}
If ($ _ POST)
{
If (funcChinese ($ _ POST ['URL'])
{
Echo 'is Chinese ';
}
Else
{
Exit ('invalid Chinese ');
}
}
// This can only be determined by characters. you can use foreach to process it.
?>
Regular expressions in Chinese and English! DOCTYPE html PUBLIC-// W3C // dtd xhtml 1.0 Transitional // EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd html xmlns = http://www.w...