This is horrible advice. If you don't check input for correctness at all, an attacker could inject all kinds of nastyness into am underlying system, which may expose bugs. For example, control characters, line breaks, shell escape characters, SQL injections, or simply uploading an ISO image into the E-mail field. There is the RFC, and there is what we would nowadays consider a sane E-mail address. Nobody has addresse…
Stop Validating Email Addresses with Regex (2012)
31–40 of 228 posts
Re: Stop Validating Email Addresses with Regex (2012)
#32Earlier quoted context omitted.
The most underrated crypto thing that people don't discuss enough, is that i don't need an email account to interact with web3 apps, i just sign in with metamask. if I could do it for every single app around that would be great.
What's wrong with a username and password?
Re: Stop Validating Email Addresses with Regex (2012)
#33As someone who sends a LOT of email for customers every week, a big percentage of our problem is incorrectly formatted emails. So we just don't even let them in these days.
People are forgetting that for services that have to send email it costs dearly to bounce.
Bounces decrease the quality of your list and you can get penalized by your email provider. By letting in stupid sh*t, you just are compromising yourself. So some simple regex that gets rid of the most egregious stuff is worth it.
Re: Stop Validating Email Addresses with Regex (2012)
#34How does it work with common e-mail clients? How do people react when you show/tell them your email?
I have a domain that uses non-ascii characters, and while I can receive emails on that domain, hosted by Fastmail, Fastmail clients refuses to _send_ emails to that domain (I can, if I type the domain as Punycode).
Re: Stop Validating Email Addresses with Regex (2012)
#351. An experienced dev just killed 54k stars on GitHub due to pressing a button in an auto-pilot mode. Do you think a Joe High who wants to give you $100 won't ever type '2' instead of '@'? What about an old lady? Or someone with physical difficulties? Have you personally ever made a typo in an email?
2. That code in the article is not color highlighted (rainbowed for Regex) or formatted properly. If I write something in any language in one line without highlighting — it'd look unreadable as well.
3. A Regex for this specific purpose is write-once-and-forget. You won't need to edit it for 20 years.
4. Regex — for practical tasks — is way easier than it's being painted. Not easy — just not as hard as some suggest.
5. I'm not a Regex fanboy (nobody is).
Re: Stop Validating Email Addresses with Regex (2012)
#36Some negligible fraction of pathological email addresses will get rejected by imperfect regular expressions. I’ve tested multiple email validation regexes against huge databases of actual emails and found they all validate.
Re: Stop Validating Email Addresses with Regex (2012)
#37Can't upvote this enough. There simply is no need to check the email addr provided by the user. Send the mail, if it bounces, the user has only himself to blame. What if I don't want them to go through the hassle of an activation link? Then I don't bother with an email account in the sign-up process in the first place. If they want a passwd reset method, they can later provide an email in their settings page, if that…
(which as far as I understand is also to protect the emailing service from getting blocked itself)
Re: Stop Validating Email Addresses with Regex (2012)
#38Here’s the regex you should use: .+@.+\..+ Works every time 100% of the time.
Re: Stop Validating Email Addresses with Regex (2012)
#39RFCs for email addresses are cool, but on the web we have our own standards! https://html.spec.whatwg.org/multipage/input.html#valid-e-ma... "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 manner…