Skip to content

Instantly share code, notes, and snippets.

@ljyf5593
Created June 19, 2014 02:50
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ljyf5593/1cba68d6cf63d25828c4 to your computer and use it in GitHub Desktop.
Save ljyf5593/1cba68d6cf63d25828c4 to your computer and use it in GitHub Desktop.
常用邮箱有效性正则规则
<?php
$reg_arr = array(
'^[0-9]{5,11}@qq\.com', // 以QQ号码为邮箱 5至11个数字
'^[a-z][a-z0-9.-_]{1,16}[a-z0-9]@(qq|foxmail)\.com', // QQ邮箱别名 3至18个英文、数字、点、减号、下划线,以英文字母开头,以英文数字结尾
'^[a-z0-9][a-z0-9_]{2,14}[a-z0-9]@sina\.(com|cn)', // 新浪 4至16个英文、数字、下划线,下划线不能在首尾
'^[a-z][a-z0-9_]{4,16}[a-z0-9]@(((163|126)\.com)|(yeah\.net))', // 网易字母邮箱,6-18字母、下划线、数字,字母开头,字母数字结尾
'^1[3|4|5|8][0-9]{9}@(163|139)\.com', // 网易手机邮箱和手机邮箱
'^[a-z0-9][a-z0-9.]{4,28}[a-z0-9]@gmail\.com', // gmail 6-30
'^[a-z][a-z0-9._]{6,30}[a-z0-9]@yahoo\.com', // 雅虎邮箱
'^[a-z][a-z0-9.-_]{3,15}@sohu.com', // 搜狐邮箱
'^[a-z][a-z0-9.-_]{0,22}[a-z0-9-_]{0,1}@(outlook|hotmail)\.com',
'^[a-z][a-z0-9-_]{3,15}@21cn.com',
'^[a-z][a-z0-9.-_]{3,25}[a-z0-9-_]@aliyun\.com', // 这个规则是猜测的,没找到注册入口
);
$reg = '/'.implode('|', $reg_arr).'/i';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment