Nicholas Cheek

LITTLE ROCK WEB DEVELOPER

Easily grabs email addresses from a bulk text (CSV and/or some other email address-filled list/db).

Example #2 takes the input (bulk text) from textarea #input and puts the clean emails in the textarea #extractedemails.

function extractEmails ( text ){
	return text.match(/([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\.[a-zA-Z0-9._-]+)/gi);
}

// EXAMPLE #1
var emails = extractEmails ( HugeListWithBulkTextIncludingEmailAddresses );
document.write ( emails.join('\n') );


// EXAMPLE #2 (jQuery)
$(function(){
	$('#eform').submit(function(){
		$('#extractedemails').val( extractEmails($('#input').val() ).join('\n'));
		return false;
	});
});

LITTLE ROCK WEB DEVELOPER

Living the dream.

nick@nicholascheek.com