Load the data into a string (I'm using $str
for that) and apply a email regular expression:
$pattern = '/[A-Z0-9._%+-]+@[^\.].*\.[a-z]{2,}/i';
if (preg_match($pattern, $str, $matches)){
echo $matches[1];
}
As Guy commented below, you can load the file into a string with:
$str = file_get_contents('/path/to/file');
EDIT:
For hotmail, you can change the pattern to:
$pattern = '/[A-Z0-9._%+-]+@hotmail.com/i';