Uwe C. Schroeder wrote:
I think I just found an error in the new masked control.
My guess is that it's also in the just released new version.
If using the EMAIL autoformat the characters excluded are wrong.
It allows an underscore (which is fine in the user part of
the email address), but disallows a dash (-) in the domain part
(which is legal there) and also allows the underscore in the domain
part which is wrong. AFAIK there are no domains with an underscore.
There might not be today, but the underscore IS legal.
I am currently in the process of making some fixes and
enhancements to maskededit.py, and am trying to fix this issue
while I'm at it.The regular expression I was using to do validation is incorrect
because I'm using \w, which includes _ but does not include -.
I was also being too restrictive in top-level domain choices,
so I looked up RFC822, and found a Backus-Naur form for email
address syntax, but no regexp...
In fact, your task is essentially impossible. Virtually every ASCII
character is allowed inside an RFC-822 e-mail address, with appropriate
quoting.
Finding it difficult to believe that this wasn't a solved
problem, I did some google research to find "standard" regular
expressions for validating email addresses. While this
turned up some examples, they all had their flaws (usually
being too permissive.)
I find that hard to believe. The fact is that virtually EVERY character is
allowed in an RFC-822 address, as long as you escape the unusual ones with
quotation marks.
Cobbling together many of them, I've come up with the following
rex that I think does the job, and also adds support for
user@[<ip addr>].
...
Is this acceptable and/or sufficient?
No, this doesn't do it. Jeffery Friedl's excellent book on "Mastering
Regular Expressions" contains the One True regular expression that accurately
matches all legal RFC-822 compliant e-mail addresses. It 6,598 characters
long. I kid you not.
ยทยทยท
On Wed, 23 Jul 2003 14:03:11 -0400, Will Sadkin <wsadkin@nameconnector.com> wrote:
--
- Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.