Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR TYPESCRIPT

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;
      }

    }
    }
 
PREVIOUS NEXT
Tagged: #email #validation #typescript
ADD COMMENT
Topic
Name
2+9 =