javascript email validation check condition issue

后端 未结 2 1216
日久生厌
日久生厌 2021-01-26 03:48

example,


javascript,

function validateEmail(email         


        
2条回答
  •  难免孤独
    2021-01-26 04:48

    Validating client-side is pretty pointless, as users can remove or even edit it. You have to check it serverside too, or don't validate at all and just mail!

     var emailfilter = /(([a-zA-Z0-9\-?\.?]+)@(([a-zA-Z0-9\-_]+\.)+)([a-z]{2,3}))+$/;
      if(emailfilter .test(string)) { //mail
    

    }

    There is no way you can validate if an emailaddress exists without mailing and waiting for the user to click the confirmation url. You only can validate if they match patterns which an email should look like.

提交回复
热议问题