Rusic has the next best implementation, with a guard against the email being blank?, it uses if not rather than unless and delimits the regex with \A and \Z.
Survey wizard has the most complete implementation which allows custom error messages. This is the implementation that I've included in this gem.
Questions
Are there any other EmailValidator implementations anywhere?
What are the advantages/disadvantages of using \A\Z vs ^$?
Any thoughts on the valid_email gem? It uses the mail gem internally to more accurately match valid email addresses.
Currently we have several implementations of
EmailValidator
. They're all very similar, but have subtle differences.This is a Good Thing™ because it means we can take the best of all of them and create One True
EmailValidator
™.Observations
blank?
, it usesif not
rather thanunless
and delimits the regex with\A
and\Z
.Questions
EmailValidator
implementations anywhere?\A
\Z
vs^
$
?Thoughts?