验证Email的正则表达式怎么写?

sghys 2005-06-15 01:10:55
第一个正则表达式为:

对邮件的@字符的验证
a. 存在@字符
b.只允许有一个@字符
c.@字符不允许放在第一个位置

第二个正则表达式为:

对邮件的用户名部分验证
a.不允许小于三个字符
b.不允许出现逗号
c.数字不能在用户名的开头

请问这两个正则表达式的语句该怎么写?谢谢!
...全文
210 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
Sam-tomcat 2005-06-15
  • 打赏
  • 举报
回复
看看这里吧,专门的正则表达式网站!常去的.
http://www.regexplib.com/DisplayPatterns.aspx
pingdan_yang 2005-06-15
  • 打赏
  • 举报
回复
\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*
新鲜鱼排 2005-06-15
  • 打赏
  • 举报
回复
http://www.yourblog.org/Data/20049/140302.html
//验证Email地址
bool IsValidEmail(string strIn)
{
// Return true if strIn is in valid e-mail format.
return Regex.IsMatch(strIn, @"^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$");
}
mathsword 2005-06-15
  • 打赏
  • 举报
回复
1,^[^@]+@[^@]+$

2,^[^@0-9,][^@,]{2,}@[^@,]+$
mathsword 2005-06-15
  • 打赏
  • 举报
回复
^(([A-Za-z0-9]+_+)|([A-Za-z0-9]+\-+)|([A-Za-z0-9]+\.+)|([A-Za-z0-9]+\++))*[A-Za-z0-9]+@((\w+\-+)|(\w+\.))*\w{1,63}\.[a-zA-Z]{2,6}$
BigIdiot628 2005-06-15
  • 打赏
  • 举报
回复

正则有空要学……
9sun888 2005-06-15
  • 打赏
  • 举报
回复
http://community.csdn.net/Expert/topic/4046/4046323.xml?temp=.8258631

110,538

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧