/** * This function filters an email address from the open page. * It returns a list of email addresses */ function email_address_extraction(){ let result = []; try{ $("body *").each(function() { let tex = $(this).text(); let regex = /[a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\.[a-z]+/g; let tmp = tex.match(regex); if (tmp !== null){ //console.log("match!") for(let i = 0; i < tmp.length; i++){ if(!result.includes(tmp[i])){ result.push(tmp[i]); } } } }); } catch(e){ console.log(e); } return result; }