Answers for "how to only accept email in the format of [email protected] js"

1

how to only accept email in the format of [email protected] js

// It's easy
const email = "[email protected]"

function ValidateEmail(mail) {
    if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(mail)) {
      console.log("It's a valid email!")
    }else{
      console.log("Not a valid email :(")
    }
  }

  ValidateEmail(email);
Posted by: Guest on April-30-2022

Code answers related to "how to only accept email in the format of [email protected] js"

Code answers related to "Javascript"

Browse Popular Code Answers by Language