Answers for "email validation in typescript"

0

email validation in typescript

validateEmail(email) {
    if(email!=''){
      const re = /^(([^<>()\[\]\\.,;:\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,}))$/;
      console.log(re.test(String(email).toLowerCase()))
      this.emailTest = re.test(String(email).toLowerCase())
      if (this.emailTest != true) {
        this.toastr.warning("please enter valid email")
        return;
      }

    }
    }
Posted by: Guest on June-23-2021

Code answers related to "TypeScript"

Browse Popular Code Answers by Language