我正在尝试找到一个正则表达式来验证带有名称和电子邮件的文本框输入(电子邮件位于尖括号中),即John Smith <john@smith.com>
)。未接受的条目为John Smith john@smith.com
或"John Smith" <john@smith.com>
。
我查看了许多帖子,但我没有看到一个涉及要求尖括号&lt;&gt;。
我看过这个帖子
regular expression for email with name
但要么我需要的信息不存在,要么我无法提取答案。我尝试了第一个答案中建议的正则表达式
^(?:(?:[a-z\d.!#$%&’*+/=?^_`{|}~-]+@[a-z\d-]+(?:\.[a-z\d-]+)*|"?([a-z]| (?! ))+"? )(?:,\s*|$))*$
但我的示例文字没有匹配。
此文本框输入只接受一个条目(名称+电子邮件)。
感谢您的帮助。
答案 0 :(得分:6)
这是实际尝试回答您的问题,因为人们似乎只是盲目地发布RFC822正则表达式...
让我们从您提供的初始正则表达式开始:
^(?:(?:[a-z\d.!#$%&’*+/=?^_`{|}~-]+@[a-z\d-]+(?:\.[a-z\d-]+)*|"?([a-z]| (?! ))+"? )(?:,\s*|$))*$
重新格式化:
^
(?:
(?:
[a-z\d.!#$%&’*+/=?^_`{|}~-]+
@
[a-z\d-]+
(?:
\.[a-z\d-]+
)*
|
"?([a-z]| (?! ))+"?
)
(?:,\s*|$)
)*
$
好的,我们可以看到它尝试匹配地址和名称列表。那不是我们想要的。我们只提取地址部分:
[a-z\d.!#$%&’*+/=?^_`{|}~-]+
@
[a-z\d-]+
(?:
\.[a-z\d-]+
)*
好,让我们调整一下,然后添加尖括号要求:
<(
[\w.!#$%&’*+/=?^_`{|}~-]+
@
[\w-]+
(?:
\.[\w-]+
)+
)>
现在,只需匹配它前面的名字即可。让我们假设一个名字可以包含任何内容。
^
\s*
(.+?)
\s*
<(
[\w.!#$%&’*+/=?^_`{|}~-]+
@
[\w-]+
(?:
\.[\w-]+
)+
)>
\s*
$
下面。看起来不错:Demo。名称位于第一组中,地址位于第二组中。
简短版本:
^\s*(.+?)\s*<([\w.!#$%&’*+\/=?^_`{|}~-]+@[\w-]+(?:\.[\w-]+)+)>\s*$
如果您想限制更多,可以限制名称中允许的字符,只允许使用字母,数字和空格:
^
\s*
([\p{L}\d\s]+?)
\s*
<(
[\w.!#$%&’*+/=?^_`{|}~-]+
@
[\w-]+
(?:
\.[\w-]+
)+
)>
\s*
$
这消除了引用的名称案例:Demo。
简短版本:
^\s*([\p{L}\d\s]+?)\s*<([\w.!#$%&’*+\/=?^_`{|}~-]+@[\w-]+(?:\.[\w-]+)+)>\s*$
答案 1 :(得分:0)
如果您要根据RFC822验证相应的电子邮件,这是正则表达式:
(?:(?:\r\n)?[ \t])*(?:(?:(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t]
)+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:
\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(
?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[
\t]))*"(?:(?:\r\n)?[ \t])*))*@(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\0
31]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\
](?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+
(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:
(?:\r\n)?[ \t])*))*|(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z
|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)
?[ \t])*)*\<(?:(?:\r\n)?[ \t])*(?:@(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\
r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[
\t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)
?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t]
)*))*(?:,@(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[
\t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*
)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t]
)+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*))*)
*:(?:(?:\r\n)?[ \t])*)?(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+
|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r
\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:
\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t
]))*"(?:(?:\r\n)?[ \t])*))*@(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031
]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](
?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?
:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?
:\r\n)?[ \t])*))*\>(?:(?:\r\n)?[ \t])*)|(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?
:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?
[ \t]))*"(?:(?:\r\n)?[ \t])*)*:(?:(?:\r\n)?[ \t])*(?:(?:(?:[^()<>@,;:\\".\[\]
\000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|
\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>
@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"
(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])*))*@(?:(?:\r\n)?[ \t]
)*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\
".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?
:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[
\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*))*|(?:[^()<>@,;:\\".\[\] \000-
\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(
?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])*)*\<(?:(?:\r\n)?[ \t])*(?:@(?:[^()<>@,;
:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([
^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\"
.\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\
]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*))*(?:,@(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\
[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\
r\\]|\\.)*\](?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\]
\000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]
|\\.)*\](?:(?:\r\n)?[ \t])*))*)*:(?:(?:\r\n)?[ \t])*)?(?:[^()<>@,;:\\".\[\] \0
00-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\
.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,
;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|"(?
:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])*))*@(?:(?:\r\n)?[ \t])*
(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".
\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t])*(?:[
^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\]
]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*))*\>(?:(?:\r\n)?[ \t])*)(?:,\s*(
?:(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\
".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])*)(?:\.(?:(
?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[
\["()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t
])*))*@(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t
])+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*)(?
:\.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|
\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*))*|(?:
[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".\[\
]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])*)*\<(?:(?:\r\n)
?[ \t])*(?:@(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["
()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)
?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>
@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*))*(?:,@(?:(?:\r\n)?[
\t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,
;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*)(?:\.(?:(?:\r\n)?[ \t]
)*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\
".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*))*)*:(?:(?:\r\n)?[ \t])*)?
(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\["()<>@,;:\\".
\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])*)(?:\.(?:(?:
\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z|(?=[\[
"()<>@,;:\\".\[\]]))|"(?:[^\"\r\\]|\\.|(?:(?:\r\n)?[ \t]))*"(?:(?:\r\n)?[ \t])
*))*@(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])
+|\Z|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*)(?:\
.(?:(?:\r\n)?[ \t])*(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t])+|\Z
|(?=[\["()<>@,;:\\".\[\]]))|\[([^\[\]\r\\]|\\.)*\](?:(?:\r\n)?[ \t])*))*\>(?:(
?:\r\n)?[ \t])*))*)?;\s*)
但最好使用模块;)
答案 2 :(得分:0)
根据RFC822验证电子邮件:
@sputnick的正则表达式格式化。
(?x)
(?:
(?: \r \n )?
[ \t]
)*
(?:
(?:
(?:
[^()<>@,;:\\".\[\] \000-\031]+
(?:
(?:
(?: \r \n )?
[ \t]
)+
| \Z
| (?= [\["()<>@,;:\\".\[\]] )
)
| "
(?:
[^\"\r\\]
| \\ .
| (?:
(?: \r \n )?
[ \t]
)
)*
"
(?:
(?: \r \n )?
[ \t]
)*
)
(?:
\.
(?:
(?: \r \n )?
[ \t]
)*
(?:
[^()<>@,;:\\".\[\] \000-\031]+
(?:
(?:
(?: \r \n )?
[ \t]
)+
| \Z
| (?= [\["()<>@,;:\\".\[\]] )
)
| "
(?:
[^\"\r\\]
| \\ .
| (?:
(?: \r \n )?
[ \t]
)
)*
"
(?:
(?: \r \n )?
[ \t]
)*
)
)*
@
(?:
(?: \r \n )?
[ \t]
)*
(?:
[^()<>@,;:\\".\[\] \000-\031]+
(?:
(?:
(?: \r \n )?
[ \t]
)+
| \Z
| (?= [\["()<>@,;:\\".\[\]] )
)
| \[
( [^\[\]\r\\] | \\ . )*
\]
(?:
(?: \r \n )?
[ \t]
)*
)
(?:
\.
(?:
(?: \r \n )?
[ \t]
)*
(?:
[^()<>@,;:\\".\[\] \000-\031]+
(?:
(?:
(?: \r \n )?
[ \t]
)+
| \Z
| (?= [\["()<>@,;:\\".\[\]] )
)
| \[
( [^\[\]\r\\] | \\ . )*
\]
(?:
(?: \r \n )?
[ \t]
)*
)
)*
| (?:
[^()<>@,;:\\".\[\] \000-\031]+
(?:
(?:
(?: \r \n )?
[ \t]
)+
| \Z
| (?= [\["()<>@,;:\\".\[\]] )
)
| "
(?:
[^\"\r\\]
| \\ .
| (?:
(?: \r \n )?
[ \t]
)
)*
"
(?:
(?: \r \n )?
[ \t]
)*
)*
\<
(?:
(?: \r \n )?
[ \t]
)*
(?:
@
(?:
[^()<>@,;:\\".\[\] \000-\031]+
(?:
(?:
(?: \r \n )?
[ \t]
)+
| \Z
| (?= [\["()<>@,;:\\".\[\]] )
)
| \[
( [^\[\]\r\\] | \\ . )*
\]
(?:
(?: \r \n )?
[ \t]
)*
)
(?:
\.
(?:
(?: \r \n )?
[ \t]
)*
(?:
[^()<>@,;:\\".\[\] \000-\031]+
(?:
(?:
(?: \r \n )?
[ \t]
)+
| \Z
| (?= [\["()<>@,;:\\".\[\]] )
)
| \[
( [^\[\]\r\\] | \\ . )*
\]
(?:
(?: \r \n )?
[ \t]
)*
)
)*
(?:
,@
(?:
(?: \r \n )?
[ \t]
)*
(?:
[^()<>@,;:\\".\[\] \000-\031]+
(?:
(?:
(?: \r \n )?
[ \t]
)+
| \Z
| (?= [\["()<>@,;:\\".\[\]] )
)
| \[
( [^\[\]\r\\] | \\ . )*
\]
(?:
(?: \r \n )?
[ \t]
)*
)
(?:
\.
(?:
(?: \r \n )?
[ \t]
)*
(?:
[^()<>@,;:\\".\[\] \000-\031]+
(?:
(?:
(?: \r \n )?
[ \t]
)+
| \Z
| (?= [\["()<>@,;:\\".\[\]] )
)
| \[
( [^\[\]\r\\] | \\ . )*
\]
(?:
(?: \r \n )?
[ \t]
)*
)
)*
)*
:
(?:
(?: \r \n )?
[ \t]
)*
)?
(?:
[^()<>@,;:\\".\[\] \000-\031]+
(?:
(?:
(?: \r \n )?
[ \t]
)+
| \Z
| (?= [\["()<>@,;:\\".\[\]] )
)
| "
(?:
[^\"\r\\]
| \\ .
| (?:
(?: \r \n )?
[ \t]
)
)*
"
(?:
(?: \r \n )?
[ \t]
)*
)
(?:
\.
(?:
(?: \r \n )?
[ \t]
)*
(?:
[^()<>@,;:\\".\[\] \000-\031]+
(?:
(?:
(?: \r \n )?
[ \t]
)+
| \Z
| (?= [\["()<>@,;:\\".\[\]] )
)
| "
(?:
[^\"\r\\]
| \\ .
| (?:
(?: \r \n )?
[ \t]
)
)*
"
(?:
(?: \r \n )?
[ \t]
)*
)
)*
@
(?:
(?: \r \n )?
[ \t]
)*
(?:
[^()<>@,;:\\".\[\] \000-\031]+
(?:
(?:
(?: \r \n )?
[ \t]
)+
| \Z
| (?= [\["()<>@,;:\\".\[\]] )
)
| \[
( [^\[\]\r\\] | \\ . )*
\]
(?:
(?: \r \n )?
[ \t]
)*
)
(?:
\.
(?:
(?: \r \n )?
[ \t]
)*
(?:
[^()<>@,;:\\".\[\] \000-\031]+
(?:
(?:
(?: \r \n )?
[ \t]
)+
| \Z
| (?= [\["()<>@,;:\\".\[\]] )
)
| \[
( [^\[\]\r\\] | \\ . )*
\]
(?:
(?: \r \n )?
[ \t]
)*
)
)*
\>
(?:
(?: \r \n )?
[ \t]
)*
)
| (?:
[^()<>@,;:\\".\[\] \000-\031]+
(?:
(?:
(?: \r \n )?
[ \t]
)+
| \Z
| (?= [\["()<>@,;:\\".\[\]] )
)
| "
(?:
[^\"\r\\]
| \\ .
| (?:
(?: \r \n )?
[ \t]
)
)*
"
(?:
(?: \r \n )?
[ \t]
)*
)*
:
(?:
(?: \r \n )?
[ \t]
)*
(?:
(?:
(?:
[^()<>@,;:\\".\[\] \000-\031]+
(?:
(?:
(?: \r \n )?
[ \t]
)+
| \Z
| (?= [\["()<>@,;:\\".\[\]] )
)
| "
(?:
[^\"\r\\]
| \\ .
| (?:
(?: \r \n )?
[ \t]
)
)*
"
(?:
(?: \r \n )?
[ \t]
)*
)
(?:
\.
(?:
(?: \r \n )?
[ \t]
)*
(?:
[^()<>@,;:\\".\[\] \000-\031]+
(?:
(?:
(?: \r \n )?
[ \t]
)+
| \Z
| (?= [\["()<>@,;:\\".\[\]] )
)
| "
(?:
[^\"\r\\]
| \\ .
| (?:
(?: \r \n )?
[ \t]
)
)*
"
(?:
(?: \r \n )?
[ \t]
)*
)
)*
@
(?:
(?: \r \n )?
[ \t]
)*
(?:
[^()<>@,;:\\".\[\] \000-\031]+
(?:
(?:
(?: \r \n )?
[ \t]
)+
| \Z
| (?= [\["()<>@,;:\\".\[\]] )
)
| \[
( [^\[\]\r\\] | \\ . )*
\]
(?:
(?: \r \n )?
[ \t]
)*
)
(?:
\.
(?:
(?: \r \n )?
[ \t]
)*
(?:
[^()<>@,;:\\".\[\] \000-\031]+
(?:
(?:
(?: \r \n )?
[ \t]
)+
| \Z
| (?= [\["()<>@,;:\\".\[\]] )
)
| \[
( [^\[\]\r\\] | \\ . )*
\]
(?:
(?: \r \n )?
[ \t]
)*
)
)*
| (?:
[^()<>@,;:\\".\[\] \000-\031]+
(?:
(?:
(?: \r \n )?
[ \t]
)+
| \Z
| (?= [\["()<>@,;:\\".\[\]] )
)
| "
(?:
[^\"\r\\]
| \\ .
| (?:
(?: \r \n )?
[ \t]
)
)*
"
(?:
(?: \r \n )?
[ \t]
)*
)*
\<
(?:
(?: \r \n )?
[ \t]
)*
(?:
@
(?:
[^()<>@,;:\\".\[\] \000-\031]+
(?:
(?:
(?: \r \n )?
[ \t]
)+
| \Z
| (?= [\["()<>@,;:\\".\[\]] )
)
| \[
( [^\[\]\r\\] | \\ . )*
\]
(?:
(?: \r \n )?
[ \t]
)*
)
(?:
\.
(?:
(?: \r \n )?
[ \t]
)*
(?:
[^()<>@,;:\\".\[\] \000-\031]+
(?:
(?:
(?: \r \n )?
[ \t]
)+
| \Z
| (?= [\["()<>@,;:\\".\[\]] )
)
| \[
( [^\[\]\r\\] | \\ . )*
\]
(?:
(?: \r \n )?
[ \t]
)*
)
)*
(?:
,@
(?:
(?: \r \n )?
[ \t]
)*
(?:
[^()<>@,;:\\".\[\] \000-\031]+
(?:
(?:
(?: \r \n )?
[ \t]
)+
| \Z
| (?= [\["()<>@,;:\\".\[\]] )
)
| \[
( [^\[\]\r\\] | \\ . )*
\]
(?:
(?: \r \n )?
[ \t]
)*
)
(?:
\.
(?:
(?: \r \n )?
[ \t]
)*
(?:
[^()<>@,;:\\".\[\] \000-\031]+
(?:
(?:
(?: \r \n )?
[ \t]
)+
| \Z
| (?= [\["()<>@,;:\\".\[\]] )
)
| \[
( [^\[\]\r\\] | \\ . )*
\]
(?:
(?: \r \n )?
[ \t]
)*
)
)*
)*
:
(?:
(?: \r \n )?
[ \t]
)*
)?
(?:
[^()<>@,;:\\".\[\] \000-\031]+
(?:
(?:
(?: \r \n )?
[ \t]
)+
| \Z
| (?= [\["()<>@,;:\\".\[\]] )
)
| "
(?:
[^\"\r\\]
| \\ .
| (?:
(?: \r \n )?
[ \t]
)
)*
"
(?:
(?: \r \n )?
[ \t]
)*
)
(?:
\.
(?:
(?: \r \n )?
[ \t]
)*
(?:
[^()<>@,;:\\".\[\] \000-\031]+
(?:
(?:
(?: \r \n )?
[ \t]
)+
| \Z
| (?= [\["()<>@,;:\\".\[\]] )
)
| "
(?:
[^\"\r\\]
| \\ .
| (?:
(?: \r \n )?
[ \t]
)
)*
"
(?:
(?: \r \n )?
[ \t]
)*
)
)*
@
(?:
(?: \r \n )?
[ \t]
)*
(?:
[^()<>@,;:\\".\[\] \000-\031]+
(?:
(?:
(?: \r \n )?
[ \t]
)+
| \Z
| (?= [\["()<>@,;:\\".\[\]] )
)
| \[
( [^\[\]\r\\] | \\ . )*
\]
(?:
(?: \r \n )?
[ \t]
)*
)
(?:
\.
(?:
(?: \r \n )?
[ \t]
)*
(?:
[^()<>@,;:\\".\[\] \000-\031]+
(?:
(?:
(?: \r \n )?
[ \t]
)+
| \Z
| (?= [\["()<>@,;:\\".\[\]] )
)
| \[
( [^\[\]\r\\] | \\ . )*
\]
(?:
(?: \r \n )?
[ \t]
)*
)
)*
\>
(?:
(?: \r \n )?
[ \t]
)*
)
(?:
, \s*
(?:
(?:
[^()<>@,;:\\".\[\] \000-\031]+
(?:
(?:
(?: \r \n )?
[ \t]
)+
| \Z
| (?= [\["()<>@,;:\\".\[\]] )
)
| "
(?:
[^\"\r\\]
| \\ .
| (?:
(?: \r \n )?
[ \t]
)
)*
"
(?:
(?: \r \n )?
[ \t]
)*
)
(?:
\.
(?:
(?: \r \n )?
[ \t]
)*
(?:
[^()<>@,;:\\".\[\] \000-\031]+
(?:
(?:
(?: \r \n )?
[ \t]
)+
| \Z
| (?= [\["()<>@,;:\\".\[\]] )
)
| "
(?:
[^\"\r\\]
| \\ .
| (?:
(?: \r \n )?
[ \t]
)
)*
"
(?:
(?: \r \n )?
[ \t]
)*
)
)*
@
(?:
(?: \r \n )?
[ \t]
)*
(?:
[^()<>@,;:\\".\[\] \000-\031]+
(?:
(?:
(?: \r \n )?
[ \t]
)+
| \Z
| (?= [\["()<>@,;:\\".\[\]] )
)
| \[
( [^\[\]\r\\] | \\ . )*
\]
(?:
(?: \r \n )?
[ \t]
)*
)
(?:
\.
(?:
(?: \r \n )?
[ \t]
)*
(?:
[^()<>@,;:\\".\[\] \000-\031]+
(?:
(?:
(?: \r \n )?
[ \t]
)+
| \Z
| (?= [\["()<>@,;:\\".\[\]] )
)
| \[
( [^\[\]\r\\] | \\ . )*
\]
(?:
(?: \r \n )?
[ \t]
)*
)
)*
| (?:
[^()<>@,;:\\".\[\] \000-\031]+
(?:
(?:
(?: \r \n )?
[ \t]
)+
| \Z
| (?= [\["()<>@,;:\\".\[\]] )
)
| "
(?:
[^\"\r\\]
| \\ .
| (?:
(?: \r \n )?
[ \t]
)
)*
"
(?:
(?: \r \n )?
[ \t]
)*
)*
\<
(?:
(?: \r \n )?
[ \t]
)*
(?:
@
(?:
[^()<>@,;:\\".\[\] \000-\031]+
(?:
(?:
(?: \r \n )?
[ \t]
)+
| \Z
| (?= [\["()<>@,;:\\".\[\]] )
)
| \[
( [^\[\]\r\\] | \\ . )*
\]
(?:
(?: \r \n )?
[ \t]
)*
)
(?:
\.
(?:
(?: \r \n )?
[ \t]
)*
(?:
[^()<>@,;:\\".\[\] \000-\031]+
(?:
(?:
(?: \r \n )?
[ \t]
)+
| \Z
| (?= [\["()<>@,;:\\".\[\]] )
)
| \[
( [^\[\]\r\\] | \\ . )*
\]
(?:
(?: \r \n )?
[ \t]
)*
)
)*
(?:
,@
(?:
(?: \r \n )?
[ \t]
)*
(?:
[^()<>@,;:\\".\[\] \000-\031]+
(?:
(?:
(?: \r \n )?
[ \t]
)+
| \Z
| (?= [\["()<>@,;:\\".\[\]] )
)
| \[
( [^\[\]\r\\] | \\ . )*
\]
(?:
(?: \r \n )?
[ \t]
)*
)
(?:
\.
(?:
(?: \r \n )?
[ \t]
)*
(?:
[^()<>@,;:\\".\[\] \000-\031]+
(?:
(?:
(?: \r \n )?
[ \t]
)+
| \Z
| (?= [\["()<>@,;:\\".\[\]] )
)
| \[
( [^\[\]\r\\] | \\ . )*
\]
(?:
(?: \r \n )?
[ \t]
)*
)
)*
)*
:
(?:
(?: \r \n )?
[ \t]
)*
)?
(?:
[^()<>@,;:\\".\[\] \000-\031]+
(?:
(?:
(?: \r \n )?
[ \t]
)+
| \Z
| (?= [\["()<>@,;:\\".\[\]] )
)
| "
(?:
[^\"\r\\]
| \\ .
| (?:
(?: \r \n )?
[ \t]
)
)*
"
(?:
(?: \r \n )?
[ \t]
)*
)
(?:
\.
(?:
(?: \r \n )?
[ \t]
)*
(?:
[^()<>@,;:\\".\[\] \000-\031]+
(?:
(?:
(?: \r \n )?
[ \t]
)+
| \Z
| (?= [\["()<>@,;:\\".\[\]] )
)
| "
(?:
[^\"\r\\]
| \\ .
| (?:
(?: \r \n )?
[ \t]
)
)*
"
(?:
(?: \r \n )?
[ \t]
)*
)
)*
@
(?:
(?: \r \n )?
[ \t]
)*
(?:
[^()<>@,;:\\".\[\] \000-\031]+
(?:
(?:
(?: \r \n )?
[ \t]
)+
| \Z
| (?= [\["()<>@,;:\\".\[\]] )
)
| \[
( [^\[\]\r\\] | \\ . )*
\]
(?:
(?: \r \n )?
[ \t]
)*
)
(?:
\.
(?:
(?: \r \n )?
[ \t]
)*
(?:
[^()<>@,;:\\".\[\] \000-\031]+
(?:
(?:
(?: \r \n )?
[ \t]
)+
| \Z
| (?= [\["()<>@,;:\\".\[\]] )
)
| \[
( [^\[\]\r\\] | \\ . )*
\]
(?:
(?: \r \n )?
[ \t]
)*
)
)*
\>
(?:
(?: \r \n )?
[ \t]
)*
)
)*
)?
; \s*
)