preg_match_all confusing failing
- by James
$string = (string) file_get_contents($_FILES['file']['tmp_name']);
echo $string;
preg_match_all("/[\._a-zA-Z0-9-]+@[\._a-zA-Z0-9-]+/i", $string, $matches);
print_r($matches);
I am parsing text/csv files and grabbing email addresses from uploaded files. When parsing a Google Contact file I exported it weirdly fails. But when I simply copy the string that is echo'd and paste that instead of the file_get_contents result, it parses and works.
Any idea why it is refusing to take the file_get_contents string, but if I paste in the raw data myself, it works?