I wanted to point out the regular expression for email addresses is actually very simple:
"([!#-\[\]-~]|\\[\u{9} -~])*"@(\[[!-Z\^-~]*\]|[!#-'*-+\-/-9=?A-Z\^-~](\.?[!#-'*-+\-/-9=?A-Z\^-~])*)|[!#-'*-+\-/-9=?A-Z\^-~](\.?[!#-'*-+\-/-9=?A-Z\^-~])*@(\[[!-Z\^-~]*\]|[!#-'*-+\-/-9=?A-Z\^-~](\.?[!#-'*-+\-/-9=?A-Z\^-~])*)
That ECMAScript regular expression 100% exactly matches the syntax for non-obsolete email address specified across RFC 5321, RFC 5322, and RFC 6532. It also prohibits comments, which are part of the MIME message syntax and not the email address itself.
Let’s break it down. Aside from the literal “@”, there’s three types of strings you find in an email address:
dot-atom
[!#-'*+\-/-9=?A-Z\^-~](\.?[!#-'*+\-/-9=?A-Z\^-~])*
This is used for both usernames and domain names!
It must start with any letters, numbers, or a variety of special characters, namely: !#$%&'*+/-=?^_`{|}~
After the first character, it also allows for a dot, and the string cannot end with a dot, so if you see a dot, at least one non-dot character must follow.
quoted-string
"([!-Z\^-~]|\\[\t -~])*"
This specifies the quoted-string form. It is surrounded by double quotes and allows all printable characters except for the backslash and double quote, or any printable character or whitespace if backslash escaped, e.g. "seti@home\ \"box\"\ 1"
domain-literal
\[[!-Z\^-~]*\]
This allows for [bracketed] strings, e.g. IPv6 addresses. Inside the brackets may contain any printable (non-control, non-whitespace) character except for the square brackets or backslash.
Putting it together
Now let’s put these together into an email address. Email addresses have the form:
(dot-atom / quoted-string) "@" (dot-atom / domain-literal)
That is, allow dot-atom or quoted-string, then a literal at-sign, then a dot-atom or a domain-literal. And that’s how you get the regular expression up top.
I don’t know where that regex you posted in the blog post came from, but it’s probably a hoax. Could you please correct it?