Created
May 27, 2014 22:14
-
-
Save jikeytang/02381e1576d00a8fb998 to your computer and use it in GitHub Desktop.
[ Javascript ] - 20140528-题目2
This file contains hidden or 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
验证邮箱合法性。规则如下,欢迎补充。 | |
1 必须为英文,不能是中文,必须为英文开始(以数字开头规则在六条),且用户名长度为6-25,即为@前长度 | |
2 包含@, .两个字符,@在点之前,@不能是首尾 | |
3 包含常用域名,如 163, 126,qq,Gmail,outlook | |
4 以.com, .org, .cn, .me 等结尾 | |
5 首尾,中间不能有空格 | |
6 如果名字以数字开头,则必为11位,且全为数字,即为常见手机号码的邮箱,如:13,15,开头的[email protected] | |
PS: | |
1. 回复时注意加上下面这句话,才会有语法高亮或格式缩进。 | |
```javascript | |
// you code | |
``` | |
2. 粘贴代码时请使用shift+tab,缩进前面的空白。 |
rambo-panda
commented
May 28, 2014
/^([a-zA-Z]{6,25}|1[35]\d{9})@(163|126|qq|gmail|outlook)\.(com|org|cn|me)$/
@zjhsd2007 1[35]\d{9} 这里不准确吧 现在还有17开头的手机号码 我使用的是 \d{11}
哦,我是看题目来的,没想那么多,呵
@zjhsd2007 拜你学正则吧。可以吗?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment