JSFiddle - React, Tailwind, and code Playground

by Shang-De You

JavaScript

function verifyEmail (email) {

  //Regular expression Testing
  emailRule = /^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z]+$/;

  //validate ok or not
  if(email.search(emailRule)!= -1){
      alert("true");
  }else{
      alert("false");
  }
}

verifyEmail('upstairs@gmail')
//[email protected]