Function is_email ($ str ){
// Check email
Return preg_match ("/^ \ w + ([-+.] \ w +) * @ \ w + ([-.] \ w + )*\. \ w + ([-.] \ w +) * $/", $ str );
}
Function is_url ($ str ){
// Check the website
Return preg_match ("/^ http: \ // [A-Za-z0-9] + \. [A-Za-z0-9] + [\/= \? % \-&_~ '@ [\] \': +!] * ([^ <> \ "])
* $/", $ Str );
}
Function is_qq ($ str ){
// Test qq
Return preg_match ("/^ [1-9] \ d {4, 8} $/", $ str );
}
Function is_zip ($ str ){
// Inspection zip code
Return preg_match ("/^ [1-9] \ d {5} $/", $ str );
}
Function is_idcard ($ str ){
// Check your ID card
Return preg_match ("/^ \ d {15} (\ d {2} [A-Za-z0-9])? $/", $ Str );
}
Function is_chinese ($ str ){
Check whether it is Chinese
Return ereg ("^ [". chr (0xa1). "-". chr (0xff). "] + $", $ str );
}
Function is_english ($ str ){
// Check whether it is in English
Return preg_match ("/^ [A-Za-z] + $/", $ str );
}
Function is_mobile ($ str ){
// Check whether it is a mobile phone
Return preg_match ("/^ (\ d {3} \) | (\ d {3 }\-))? 13 \ d {9 }$/", $ str );
}
Function is_phone ($ str ){
// Whether the phone number is used for cloud Creation
Return preg_match ("/^ (\ d {3} \) | (\ d {3 }\-))? (\ (0 \ d {2, 3} \) | 0 \ d {2, 3 }-)? [1-9] \ d {6, 7} $ /",
$ Str );
}
Function is_safe ($ str ){
Return (preg_match ("/^ ([A-Z] * | [a-z] * | \ d * | [-_\~! @ # \ $ % \ ^ & \ * \. \ (\) \ [\] \ {\} <> \? \/\ '\ "] *) |.
{0, 5}) $ | \ s/", $ str )! = 0 );
}
}