用 Regular Expression 表示合法 e-mail 位置似乎是每隔一陣子就會被拿出來大家笑的東西?
Photo Matt 提到的 Validate Emails:
(?:(?:\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*)