validate email with regex jquery

前端 未结 5 778
名媛妹妹
名媛妹妹 2020-12-06 18:09

referring to this issue:

how can I set a minimum length for a field with jquery?

5条回答
  •  渐次进展
    2020-12-06 18:58

    This regex can help you to check your email-address according to all the criteria which gmail.com used .

    var re = /^\w+([-+.'][^\s]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;
    
    var emailFormat = re.test($("#email").val());// this return result in boolean type
    
    if (emailFormat) {}
    

提交回复
热议问题