preg_match_all confusing failing
Posted
by
James
on Stack Overflow
See other posts from Stack Overflow
or by James
Published on 2011-01-14T04:34:33Z
Indexed on
2011/01/14
4:53 UTC
Read the original article
Hit count: 169
php
|preg-match-all
$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?
© Stack Overflow or respective owner