`const regex = /\S+@\S+.\S+/
console.log(regex.test("miraj@gmailcom"))
const data =/[a-zA-Z0-9._-]{3,}@[a-zA-Z0-9.-]{3,}.[a-zA-Z]{2,4}/
const email ='mirajhadish49@gmail.com'
console.log(email.match(data)? 'yes':'no');`
`const regex = /\S+@\S+.\S+/
console.log(regex.test("miraj@gmailcom"))
const data =/[a-zA-Z0-9._-]{3,}@[a-zA-Z0-9.-]{3,}.[a-zA-Z]{2,4}/
const email ='mirajhadish49@gmail.com'
console.log(email.match(data)? 'yes':'no');`
For further actions, you may consider blocking this person and/or reporting abuse
Aiden Isaac -
Matheus Fernandes Rodrigues -
Roy amit -
Jakub Bobkowski -
Top comments (3)
Your regex does not validate account+topic@example.com but this email is a valid email.
You should not try to validate an email this way, see emailregex.com/ for a better approach ;-)
Hi Franck, this email it can validate
The regex validate only the part after the + sign, see regex101.com/r/DlHS02/1
Another valid email as me&@domain.academy is not valid with your regexp (the & character is valid in it).
Another point: the TLD (last part of domain) might be 63 characters long (see data.iana.org/TLD/tlds-alpha-by-do...), you have a set a range to 2-4.
So sometimes your regex give a true answer, but it does not fully validate an email.