4 ms·
I love these articles that are posted and the ACCURATE answer is that the article proposes bad advice. In what world is not validating an email a good thing? I
by invisible 13y ago
I love these articles that are posted and the ACCURATE answer is that the article proposes bad advice.
In what world is not validating an email a good thing? It's not like emails vary after a certain complexity is reached. A better article would have been someone documenting a validation regex that approaches perfect without exceeding insane complexity.
Next we'll see articles to not run the Luhn algorithm on credit cards =/.
- DanBC 13y ago> In what world is not validating an email a good thing? Validating an email address is important. The way you do that is send an email to that address. You can't do it with regex, and attempting to do so leaves you open to a variety of flaws.
- invisible 13y agoThat is not validating - that is accepting it blindly into your database. You potentially just lost a user and/or customer (or made them unhappy because now they have to register again). Like I said, when you accept a credit card, normally you validate the formatting of the card before trying to charge money using the info. Emails are very similar.
- DanBC 13y agoWhat? They give you their email. You immediately send them an email with a confirmation link. They confirm, at which point you put their email in your database. You must send them a confirmation link because you shouldn't be sending them email in the future unless you've had them confirm their address and that they want to receive email from you. You appear (but perhaps I'm misunderstanding you) to be asking a user to enter their email address; checking that against a regex; storing it; and sending email to it. That's bad, don't do that. > You potentially just lost a user and/or customer (or made them unhappy because now they have to register again) You're potentially losing customers because their valid email addresses are not validating through your broken regex; or their incorrect email is validating through your regex. > when you accept a credit card, normally you validate the formatting of the card Credit cards are trivially easy to check for formatting. You use the Luhn algorithm which tells you if it's possible for that number to be valid or not. This is because there's a strict format for credit cards. There is no such format for email addresses. That's why the only sensible way to check a user's email address is to send a confirmation email to them.
- invisible 13y agoUsing a simple regex isn't a bad thing. 99.99999999% of my users aren't using a TLD so the regex .+@.+\..{1,63} is great. The problem is that people are naive and write incorrect regexes. Also, don't attribute bad programming to me in your comments when you have no idea what regex I use - that's just rude and belligerent. Emails are trivially easy to check for basic user errors - such as leaving off the TLD or not even providing the domain. Saying otherwise is just being naive again.
- mkehrt 13y agoI regularly run into email fields that won't accept +. This is just an extension of that thinking.
- invisible 13y agoThen that is a very poor validation attempt. Sidestepping things that have been programmed poorly in the past doesn't make for good programming practices.