Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function validateEmail(email) {
- // Regular expression to match a valid email address
- const regex = /^[a-zA-Z0-9.]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
- // If the email address does not match the regular expression, return false
- if (!regex.test(email)) {
- return false;
- }
- // Otherwise, the email address is valid, so return true
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement