validating email address using regular expression on razor page

后端 未结 3 2295
孤城傲影
孤城傲影 2021-02-20 10:39

Hi I am using razor and trying to use regular expression to validate email address here the validation function

function validateEmail(txtEmail){
   var a = doc         


        
3条回答
  •  天命终不由人
    2021-02-20 10:57

    It is common to check the format of the email is valid or not. To validate email address we need to use regular expression. In MVC razor we should use @@ symbol to perform validation. MVC razor:

    var emailRegEx = /^(([^<>()[]\.,;:\s@@\"]+(.[^<>()[]\.,;:\s@@\"]+)*)|(\".+\"))@@(([[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}])|(([a-zA-Z-0-9]+.)+[a-zA-Z]{2,}))$/;

    Normal Html:

    For normal we should use @ symbol to perform validation

    var emailRegEx = /^(([^<>()[]\.,;:\s@\"]+(.[^<>()[]\.,;:\s@\"]+)*)|(\".+\"))@(([[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}])|(([a-zA-Z-0-9]+.)+[a-zA-Z]{2,}))$/;

    for more details visit

提交回复
热议问题