//判定是否为中文
function isChinese($str){
return preg_match(“/[\x7f-\xff]/”,
$str);
}
//关于邮箱
//判定是否为邮箱
function
checkEmail($email){
return (ereg(“^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+”,$email));
}
//匹配出邮箱
$emails = “aa@126.comha12aa@163.com”;
preg_match_all(“/([a-z0-9_\-\.]+)@(([a-z0-9]+[_\-]?)\.)+[a-z]{2,3}/i”, $emails, $matches);
var_dump($matches[0]);
//关于手机号和电话
//匹配脱手机以及电话号码
$tel = “13911112222sf010-44444442dfg18811112222″;
preg_match_all(“/1[3,5,8]{1}[0-9]{1}[0-9]{8}|0[0-9]{2,3}-[0-9]{7,8}(-[0-9]{1,4})?/”, $tel, $matches);