Created
January 20, 2015 23:59
-
-
Save raulsilvamx/5f70e1f3269a59df2b9a to your computer and use it in GitHub Desktop.
phpEmailExtractor
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
<?php | |
/* @author @raulsilvamx | |
* @create 20/01/2015 11:25:47 AM | |
* @file phpEmailExtractor.php | |
*/ | |
//SOURCE FOR EXTRACT EMAILS | |
$string = file_get_contents("/Users/<USER>/Sites/phplist/Inbox.txt"); // Load text file contents | |
$pattern = '/[A-Za-z0-9_-]+@[A-Za-z0-9_-]+\.([A-Za-z0-9_-][A-Za-z0-9_]+)/'; //regex for pattern of e-mail address | |
preg_match_all($pattern, $string, $matches); | |
$matches = array_unique($matches[0]); | |
ksort($matches); | |
var_dump($matches); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment