Hello,
I have a large file full of text and in there are some email addresses.
Which php regular expression function would return an array of email addresses it could find?
So far I have
<?php
$pattern = "/^[^@]*@[^@]*\.[^@]*$/";
if ($handle = opendir('files')) {
/* This is the correct way to loop over the directory. */
while (false !== ($file = readdir($handle))) {
preg_match($pattern, $file, $matches);
echo count($matches);
foreach ($matches as $email) {
echo "$email <br />";
}
}
closedir($handle);
}
but it returns no results