Regex for validating emails
In what world is not validating an email a good thing?
It's not like emails vary after a certain complexity is reached.
I hear and understand a lot of the comments on this thread mention that regex saves the user from a typo and such.
So I want to vouch for a github project called mailcheck by the Kicksend team that's great.
Of course, gmail is going to be the more common case.
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. 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. 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.
You use the Luhn algorithm which tells you if it's possible for that number to be valid or not. 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.
Still, it looks good overall and an improvement over no client side validation.