Daisuke Aritomo 397bb12778 [ruby/uri] Re-allow consecutive, leading and trailing dots in EMAIL_REGEXP
Effectively reverts commit https://github.com/ruby/uri/commit/788274b180d6 and
https://github.com/ruby/uri/commit/0abac721d8fe.

EMAIL_REGEXP was mostly drawn from WHATWG HTML LS. This spec states that
it intentionally violates RFC 5322 to provide a practical regex for
validation.

> This requirement is a willful violation of RFC 5322, which defines a
> syntax for email addresses that is simultaneously too strict (before the
> "@" character), too vague (after the "@" character), and too lax
> (allowing comments, whitespace characters, and quoted strings in manners
> unfamiliar to most users) to be of practical use here.

The allowing of consecutive dot s(`a..a@`) and leading/trailing dots
(`.a@`, `a.@`) is not the only derivation from RFC 5322. If a truly RFC
5322-compliant regexp is needed, tt should be organized under a
different name, since too much departure from the original EMAIL_REGEXP
must be introduced.

https://github.com/ruby/uri/commit/c551d7020b
2025-11-04 06:45:16 +00:00
..