binarylogic/authlogic — pull request #408 by temochka (2014-04-22 02:14:32+00:00)
Title: Update email regexp to allow top-level domains up to 13 characters long

We recently started getting complaints from users with email TLDs longer than 4 characters: *.email, *.photography, etc. By doing a quick analysis of [IANA’s list](http://data.iana.org/TLD/tlds-alpha-by-domain.txt) it becomes apparent that it is no longer possible to validate TLDs longer than 4 characters against a predefined whitelist. Here is a simple Ruby snippet to reinforce this argument:

``` ruby
open('http://data.iana.org/TLD/tlds-alpha-by-domain.txt').
each_line.
lazy.
reject { |l| l.start_with?('XN--') || l.start_with?('#') }.
map(&:strip).
reduce({}) { |m, l| m[l.length] = m[l.length].to_i + 1; m }.
sort_by { |k, v| k }.
each { |(d, l)| puts "#{d}\t#{l}" }
# length count
# 2 249
# 3 34
# 4 47
# 5 35
# 6 36
# 7 28
# 8 22
# 9 9
# 10 9
# 11 5
# 12 1
# 13 1
```

Also the [page](http://www.regular-expressions.info/email.html) used to build the existing regexp clearly states: "Regexes Don’t Send Email" to make a point that no regexp is going to protect you from users submitting non-existing emails.

Given all this I believe it should be safe to extend this limit. Please let me know what you think.