^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))
@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)
+[a-zA-Z]{2,}))$
我只能理解正则表达式的部分而不是整个表达式,比如
([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)
匹配一个或多个不是字符
的字符<>()[\]\\.,;:\s@\" \\ Not sure what this [\]\\ and \s@\ means
我也能理解其他一些部分,但不能理解为单个实体。
答案 0 :(得分:5)
你走了:
^(
(
[^<>()[\]\\.,;:\s@\"]+ // Disallow these characters any amount of times
(
\. // Allow dots
[^<>()[\]\\.,;:\s@\"]+ // Disallow these characters any amount of times
)* // This group must occur once or more
)
| // or
(\".+\") // Anything surrounded by quotes (Is this even legal?)
)
@ // At symbol is litterally that
(
// IP address
(
\[ // Allows square bracket
[0-9]{1,3} // 1 to three digits (for an IP address
\. // Allows dot
[0-9]{1,3} // 1 to three digits (for an IP address
\. // Allows dot
[0-9]{1,3} // 1 to three digits (for an IP address
\. // Allows dot
[0-9]{1,3} // 1 to three digits (for an IP address
\] // Square bracket
)
| // OR a domain name
(
([a-zA-Z\-0-9]+\.) // Valid domain characters are a-zA-Z0-9 plus dashes
+
[a-zA-Z]{2,} // The top level (anything after the dot) must be at least 2 chars long and only a-zA-Z
)
)$
答案 1 :(得分:5)
这是一个来自debuggex.com的简单插图
答案 2 :(得分:4)
“不确定此[\]\\
和\s@\"
的含义是什么”
\]
是转发的]
\\
是一个已转义的\
\s
是任何空格
@
是@
\"
是转发的"
“+是什么意思”
+
表示+