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
91–100 of 211 posts
Re: Stop Validating Email Addresses With Your Complex Regex
#92Re: Stop Validating Email Addresses With Your Complex Regex
#93My goto for email validation is /^.+?@.+?\..+?$/ Incase I've typed it wrong, that should basically work for anything that contains at least one @ and one dot, in that order, as well as at least one character at beginning, middle and end. It's served me well thusfar. Edit for clarification: The reason I prefer this over just checking for an @ is that if you're just checking for @ a common mistake like "me@hotmail,com"…
My favorite: /.\@.*\../ It should be similar to your version, but only matches just enough parts that require for email validation (i.e. "o@example.c" part of foo@example.com).
Re: Stop Validating Email Addresses With Your Complex Regex
#94Earlier quoted context omitted.
Because it takes system resources to deliver email. Furthermore, if people make a simple typo, why go to the extent of attempting to send something to it when it's obvious?
Because it's not obvious. Ask developers to recite the rules for correct email address, and most of them will get it laughably wrong. I blame the standard, which is far more "featureful" than is actually required, but that is the way it is.
Re: Stop Validating Email Addresses With Your Complex Regex
#95As a side note, be cautious of using such a tactic. I have recieved their logins, CC and Physcial Address information because of this.
Re: Stop Validating Email Addresses With Your Complex Regex
#96Earlier quoted context omitted.
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…
Plus a Large Regex for mail validation is not supposed to be heavily used. It's supposed to be used once at registration for example. So why would it matter if it's slow/heavy/...
Re: Stop Validating Email Addresses With Your Complex Regex
#97I don't think this is good advice. From a previous startup we saw a ton of signups like, "john@gmail" and the like. Obviously this person will not get a validation email -- and in all likelihood will not be able to log in to his account when he returns. It's best to catch him when he's entering the information.
Re: Stop Validating Email Addresses With Your Complex Regex
#98Amen! Anyone else here use myemail+token@gmail.com when they have to register with their email to find out who is selling them out and to make spam filters easier? It still amazes me that 70% of the places I attempt using foo+bar@gmail.com call it invalid. And that does not even begin to touch the myriad valid permutations that are "invalid" out there.
Re: Stop Validating Email Addresses With Your Complex Regex
#99I would rather lose a few users through a faulty regexp than lose double digit percentage through an email activation step.
No regexp in the world will tell you if an email address is real.
However, they can, if implemented correctly, tell you if the email address is syntactically valid.
Re: Stop Validating Email Addresses With Your Complex Regex
#100 /.+@.+\..+/i
A trailing dot is valid at the end of a domain name. These domains are said to be fully qualified.http://www.dns-sd.org/TrailingDotsInDomainNames.html
This also potentially eschews internal deployment.
His other suggesiton, /@/, at least, is not harmful, but there are validators based on the RFC that do the job for most platforms.
Validating the address may provide useful feedback to users who accidentally mistyped something, invalidating the permise of his last paragraph.
.
/someone is wrong on the internet.