Re:Stop Validating Email Addresses with Regex (2012)
by easrng on Wednesday April 20, 2022 @01:43AM
(#31093273)
Domains ending with a dot are valid though, and it's needed sometimes. For example, someone@ai. (ai. is a TLD) is a different email than someone@ai (ai is a local hostname)
[ Parent
| on HN ]
Re:Stop Validating Email Addresses with Regex (2012)
by Biganon on Wednesday April 20, 2022 @08:00AM
(#31095637)
I'm pretty sure the one guy behind ai. doesn't justify that you change your regex for him. Let's not be overly pedantic.
Re:Stop Validating Email Addresses with Regex (2012)
by Beltalowda on Wednesday April 20, 2022 @06:15AM
(#31094779)
> it's needed sometimes
When is this needed in the context of a Rails app? You never want to send emails to local hosts, and emails directly on the TLD is possible, but very little will work with them in practice.
Re:Stop Validating Email Addresses with Regex (2012)
by turminal on Wednesday April 20, 2022 @08:02AM
(#31095646)
> You never want to send emails to local hosts
That's not entirely true, it depends on how your mailing infrastructure is set up.
Re:Stop Validating Email Addresses with Regex (2012)
by Beltalowda on Wednesday April 20, 2022 @08:32AM
(#31095912)
But in the context of a web app though? That's the key part: you're taking in email addresses from myapp.example.com. For other cases: sure, local email addresses can be useful (not often these days, but sometimes still are). But in this context I'm not really seeing any use case.
Re:Stop Validating Email Addresses with Regex (2012)
by bbatha on Wednesday April 20, 2022 @09:57AM
(#31097015)
At previous $work, I wrote a rails app that managed releases. On the app you could sign up for email notifications when your change was released. These went through the unix local email system. So yes there is very much a use case
Re:Stop Validating Email Addresses with Regex (2012)
by lolinder on Wednesday April 20, 2022 @11:27AM
(#31098326)
It's still a bit silly to tell every SaaS developer that they shouldn't validate that they have a normal-looking domain because some people's use cases call for sending emails to local addresses or to TLDs directly. If a developer needs to handle those cases, they know already, and they're in a vanishingly small minority.
Re:Stop Validating Email Addresses with Regex (2012)
by hathawsh on Wednesday April 20, 2022 @01:44AM
(#31093287)
Good to know. I guess I'll simplify again. Besides, I wonder whether the expression is vulnerable to catastrophic backtracking.
Re:Stop Validating Email Addresses with Regex (2012)
by Supermancho on Thursday April 21, 2022 @12:35PM
(#31111671)
> Domains ending with a dot are valid though,
That doesn't mean you have to support their use. I have never seen a company support an email ending in a period and the world seems to continue along.