Last active
August 29, 2015 14:02
-
-
Save ruslankonev/dfb2d401b7b08de40eef to your computer and use it in GitHub Desktop.
Find and unique all emails in page (javascript)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var body = window.document.body.innerHTML; | |
//var body = document.querySelector('td.Bu').innerHTML | |
var regular = /\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b/ig; | |
var arrayUnique = function(a) { | |
return a.reduce(function(p, c) { | |
if (p.indexOf(c) < 0) p.push(c); | |
return p; | |
}, []); | |
}; | |
arrayUnique(body.match(regular)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment