Last active
June 12, 2019 04:46
-
-
Save daqi/2aeb0d8be0f58e4088cd73a844a4cebd to your computer and use it in GitHub Desktop.
FilterContactInfo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function FilterContactInfo($str){ // 过滤手机号码、QQ号、邮箱、地址 | |
$str = preg_replace('/(Q|Q|扣扣|企鹅|扣|联系|手机|电话|号)+[:[:punct:]一二三四五六七八九零壹贰叁肆伍陆柒捌玖\d1234567890①②③⑤]+/i', '', $str); | |
// 过滤网址、邮箱 | |
$str = preg_replace('/(网址|邮箱)*[\::]*[a-z]*\@?[a-z\-]+([\.\。][a-z]+)+/i', '', $str); | |
return $str; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment