Created
May 31, 2022 17:16
-
-
Save Avi-E-Koenig/c96163ec82b4ae6f015780de8171b32c to your computer and use it in GitHub Desktop.
Simple Regex Email Tester
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const isValidEmail = (emailStr) => { | |
const regex = /[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?/ | |
const res = regex.test(emailStr.toLowerCase()); | |
console.log("🚀 ~ file: validateEmail.js ~ line 5 ~ isValidEmail ~ res", res) | |
return res | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment