Regular expression for email
Possible Duplicate:
What is the best regular expression for validating email addresses?
I tried the reg expression
^([a-zA-Z0-9_.-])+@([a-zA-Z0-9_.-])+.([a-zA-Z])+([a-zA-Z])+
for the email validation.
Since I want the user to allow submitting even with the empty email address. So I changed the reg ex to
(^([a-zA-Z0-9_.-])+@([a-zA-Z0-9_.-])+.([a-zA-Z])+([a-zA-Z])+)?
But this expression accepts any email address without any validation.
Thanks Konerak!!!! I changed the expression to
^(([a-zA-Z0-9_.-])+@([a-zA-Z0-9_.-])+.([a-zA-Z])+([a-zA-Z])+)?$
and this is working for me.
Welcome. http://www.ex-parrot.com/pdw/Mail-RFC822-Address.html
如何验证字符串是否处于有效的电子邮件格式
链接地址: http://www.djcxy.com/p/16576.html下一篇: 电子邮件正则表达式