emailregex.com
const expression = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
const emails = [
`simple@example.com`,
`very.common@example.com`,
`disposable.style.email.with+symbol@example.com`,
`other.email-with-hyphen@example.com`,
`fully-qualified-domain@example.com`,
`user.name+tag+sorting@example.com`,
`x@example.com`,
`example-indeed@strange-example.com`,
`admin@mailserver1`,
`example@s.example`,
`" "@example.org`,
`"john..doe"@example.org`,
`mailhost!username@example.org`,
`user%example.com@example.org`,
];
for (const email of emails) {
console.log(email, expression.test(email));
}
/*
'simple@example.com' true
'very.common@example.com' true
'disposable.style.email.with+symbol@example.com' true
'other.email-with-hyphen@example.com' true
'fully-qualified-domain@example.com' true
'user.name+tag+sorting@example.com' true
'x@example.com' true
'example-indeed@strange-example.com' true
'admin@mailserver1' false
'example@s.example' true
'" "@example.org' true
'"john..doe"@example.org' true
'mailhost!username@example.org' true
'user%example.com@example.org' true
*/