Overall, I found this article quite informative
about AJAX.
However, I was very disappointed that your
validity-checking code for email addresses
is incorrect. Where did you get the idea that
that RE matched valid email addresses? Have
you ever checked RFC-2822?
First, the "local part" (that is, the part
before the "@") can have many more characters
than just alphanumerics, underscores and hyphens.
The code you give would reject many correct
email addresses (including mine -- which is
why I'm particularly sensitive about it).
Second, according to STD13 and STD66, the
"label" parts of domain names, can contain
only alphanumerics (not underscores) and
embedded hyphens. Your RE would accept
syntactically invalid addresses containing
underscores or with leading or trailing
hyphens.
Putting up incorrect examples like this serves
only to spread broken address checking, when
readers copy your code. I strongly suggest
that you fix it.
|