What is the correct regular expression for an email address?
Duplicate : Using a regular expression to validate an email address
There seem to be an awful lot of different variants on this on the web and was wondering if there is a definitive answer?
Preferably using the .net (Regex) dialect of regular expressions.
This question has been asked and answered several times:
Using a regular expression to validate an email address
Why are people using regexp for email and other complex validation?
Regexp recognition of email address hard?
Specifically related to .NET:
Validating e-mail with regular expression VB.Net
正则表达式说这个匹配约99%
[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?
The definitive answer? Or the normal answer?
I ask because the formal email address specification allows all sorts of weird things (parenthesis, quoted phrases, etc) that most people don't bother to account for.
See this page for a list of both comprehensive and normal regex'es.
链接地址: http://www.djcxy.com/p/16572.html上一篇: 电子邮件正则表达式
下一篇: 什么是电子邮件地址的正确表达式?