The RFC validator is IMHO not a good default email validator. The main problem is that RFC822 is pretty relaxed. For example "Neuman@BBN-TENEXA" is a valid mail address. I am not certain, but I remember that even something like "user" is a valid mail address. Its fairly easy for a human to see that these won't fly in most applications.

If you insist on full RFC822 behavior but do not want to use a regular expression, then you can use javax.mail.internet.InternetAddress from javax.mail (http://docs.oracle.com/javaee/1.4/api/javax/mail/internet/InternetAddress.html). It would introduce a dependency though.

Cheers,
    Erik.


Op 22-07-12 14:33, Emond Papegaaij schreef:
The main problem I'm having with this regular expression, is that it
is impossible to understand what exactly it matches and how. I
wouldn't be surprised if the performance varies greatly depending on
the input you are giving it, for example invalid addresses or very
long (too long) addresses.

Best regards,
Emond

On Sat, Jul 21, 2012 at 10:50 PM, Dan Retzlaff <[email protected]> wrote:
The RFC validator is not slow. Here are results of single
compile/validations, and 10 second runs on my 2.5GHz CPU:

1 compile in 6.675063 millis
compiles per second = 7226.300000
1 validation in 0.144235 millis
validations per second = 425048.100000

https://gist.github.com/3157128

On Sat, Jul 21, 2012 at 12:22 PM, Martin Grigorov <[email protected]>wrote:

Compiling the pattern is the slower operation. The matching is not
that slow. Since the Pattern is static it is compiled just once.
Having semi-working solution like current EmailAddressValidator is not
an option.
If Rfc** one proves to be slow then we should better find a way to
optimize it or find another RFC compliant solution.

On Sat, Jul 21, 2012 at 9:29 PM, Burton, Tom F (DOR)
<[email protected]> wrote:
What about speed isn't regular expression matching slow? And wouldn't
matching on a gigantic regular excpression like RFCCompliantValidator take
a while?
Tom Burton

Sent from my HTC

----- Reply message -----
From: "Martijn Dashorst" <[email protected]>
To: "[email protected]" <[email protected]>
Subject: [vote] deprecate/remove EmailAddressValidator and move
RfcCompliantEmailAddressValidator to core
Date: Fri, Jul 20, 2012 4:50 am



EmailAddressValidator is broken. For example, it doesn't validate
"Martijn Dashorst <[email protected]>" properly, which is
standards compliant. Rfc validator does work. The only reason why RFC
validator was not admitted to core, was its memory consumption due to
the regular expression. But since RFC is now singleton, I severely
doubt that is still an issue.

[ ] Copy RfcCompliantEmailAddressValidator over EmailAddressValidator,
deprecate RfcCompliantEmailAddressValidator
[ ] Deprecate EmailAddressValidator, move
RfcCompliantEmailAddressValidator to core, favor RFC in EmailTextField
[ ] Keep it as currently implemented

Martijn


--
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com



--
Erik van Oosten
http://www.day-to-day-stuff.blogspot.com/

Reply via email to