regrex for email code example

Example 1: email regex

//Author: Mohammad Arman Khan
//Regular Expresssion for e-mail validation
var email_validator_regex = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/;

Example 2: email regex

//Provided by Youtube: CodingBite

let email='[email protected]'
const handleSubmit = () => {
        let mailformat = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/;
        let Email = email.trimLeft()
        Email != ''
            ? Email.match(mailformat)
                ? alert('Sucess')
                : alert('Enter Correct Mail!')
            : alert('Fill email first!')
    }