You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
560 B
29 lines
560 B
4 years ago
|
/**
|
||
|
* 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;
|
||
|
}
|