|
|
|
|
|
by jedberg
475 days ago
|
|
> I have a very long regular expression (email validation of course) On a tangentially related note, I guarantee you that your regex is wrong. There is only one way to validate an email address: Send an email to it and have them respond. Otherwise you will block some valid users. Now of course you can make a regex that gets most email addresses, and if you're ok with that, then that's fine. But if you don't want to accidentally exclude someone, then sending email is the only way to validate it. |
|
Why is everyone trying to check for things they don't have to? If you need a valid email address, of course you have to send an email for confirmation. anna@example.com is perfectly syntactically valid, but isn't useful to anyone for sending emails. If you optionally want your users to enter an email address, don't overcomplicate things.