RFC822: email address validation with regular expressions

后端 未结 5 438
醉酒成梦
醉酒成梦 2020-12-07 03:40

as you know, this is how we validate an email address:

(?:(?:\\r\\n)?[ \\t])*(?:(?:(?:[^()<>@,;:\\\\\".\\[\\] \\000-\\031]+(?:(?:(?:\\r\\n)?[ \\t]
)+|\         


        
5条回答
  •  醉酒成梦
    2020-12-07 04:23

    My policy about email validation is: forget about it. Unicode domains aside, a user can give you a syntactically valid fake address (e.g. test@mailinator.com ).

    Instead of validating the email address with that huge (and possibly computationally expensive??) expression

    1) send a confirmation link to the user, that way you will know if the email address exist

    2) check against Mailinator & Co. domains

提交回复
热议问题