I'm using regex and match to grab all emails in an HTML string, however I'm getting false positives, how can I improve my regex (I'm not very good at it), I'd like to add something like "ends in .com" so I don't grab any false matches.
const emailRegex = /([\s]*)([_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*([ ]+|)@([ ]+|)([a-zA-Z0-9-]+\.)+([a-zA-Z]{2,}))([\s]*)/ig;
let emailsInFacebook = bodyHTML.match(emailRegex);
This gives me an array with false positives like this one:
emails:
{
'0': 'badge-silver_es_ES@2x.jpg',
'2': 'badge-silver_es_ES@2x-150x150.jpg',
'3': 'info@grupomonico.com'
}