The question is why people are validating the email in the first place. * to ensure it is deliverable? Well, then you better send them an email. * to let people know when they misread the labels and put something that was clearly not an email in the email field? A simple check for an at-sign is usually sufficient. * because some tester opens a ticket saying you can enter an invalid email in the email field? Yeah, tha…
Stop Validating Email Addresses With Your Complex Regex
51–60 of 211 posts
Re: Stop Validating Email Addresses With Your Complex Regex
#52Re: Stop Validating Email Addresses With Your Complex Regex
#53For those that use PHP, use the following: filter_var($email, FILTER_VALIDATE_EMAIL); Regex from the source: https://github.com/php/php-src/blob/master/ext/filter/logica...
http://fightingforalostcause.net/misc/2006/compare-email-reg...
Re: Stop Validating Email Addresses With Your Complex Regex
#54If you really want to do checking of email addresses right on the signup page, include a confirmation field so they have to type it twice. No. This puts the burden of checking email validity on every user , even perfectly capable valid users. If you're validating for edge cases (mistakes or otherwise invalid addresses), treat it as an edge case and don't annoy users who can type.
Re: Stop Validating Email Addresses With Your Complex Regex
#55Re: Stop Validating Email Addresses With Your Complex Regex
#56This has been an issue since the day I started programming for the web, back somewhere in '95. It has regularly come up on HN, and pretty much any programming related forum I've used since the mid-90's. As an industry at the heart of the information society you have to wonder what the hell we are doing wrong if we cannot stop this constant regression into well known bad practices.
I understand the argument re validating email addresses passively (regex, no regex, etc.) vs actively (send an email by SMTP). What I don't understand with this ever-repeating discussion is why the complexity has to be visible. e.g. > > Yeesh. Is something that complex really necessary? Many functions are complex - we put those in libraries, pushing them under the hood, and move on. What is so special about parsing e…
A valid email address can contain almost anything; this makes validation via a standard parser mostly useless. As such, devlopers reach for stricter parsers out of a combination of a not comprehending the standards, feeling vague discomfort about letting 'just anything' past data validation, and misplaced concern for users that they believe can't type their own e-mail address.
Add to that the occasional business complaint from the marketing arm about bogus e-mail addresses, and you have people repeatedly solving the problem in slightly different ways, justifying their own divergences from the standard by applying the justification that nobody will use a 'weird' address anyway, and they're actually being helpful.
Re: Stop Validating Email Addresses With Your Complex Regex
#57The question is why people are validating the email in the first place. * to ensure it is deliverable? Well, then you better send them an email. * to let people know when they misread the labels and put something that was clearly not an email in the email field? A simple check for an at-sign is usually sufficient. * because some tester opens a ticket saying you can enter an invalid email in the email field? Yeah, tha…
Re: Stop Validating Email Addresses With Your Complex Regex
#58Don't bother even reading it. His solution is to "Just send your users an email. The activation email is a practice that’s been in use for years, but it’s often paired with complex validations that the email is formatted correctly. If you’re going to send an activation email to users, why bother using a gigantic regular expression?" Want to know why it's not more common than the regex "method"? His method has its own…
Kinda harsh sentiment considering that we all mistype stuff, especially on site that disable auto complete.
Re: Stop Validating Email Addresses With Your Complex Regex
#59Earlier quoted context omitted.
I think that the domain part of email addresses could be an IP address. Depending on how IPv6 addresses are displayed there, they won’t contain a dot. Somewhat artificial, yes.
I'll admit I hadn't considered IPv6b addresses, might have to rethink my trusty regex. Sad, it's served me well for so many years.
Re: Stop Validating Email Addresses With Your Complex Regex
#60I would rather lose a few users through a faulty regexp than lose double digit percentage through an email activation step.