View Full Version : Preg_Match_All Question

02-19-2010, 08:21 PM
Hi I have a Google Checkout script that automatically logs info into a .log file. I want to make it easier for myself to view any email address' that might be there.

I know the method is preg_match_all after doing some google searching, I'm just not sure of the syntax.

Thanks so much for your help.

02-19-2010, 08:41 PM
Depending on the format of the log, it might be easier to use something like explode rather than a regex for this. can you give the format of the log file?

Otherwise, here's the preg_match_all manual page
and here's some regexes for email addresses

02-19-2010, 09:06 PM
Hey, thanks for responding.

I'm still throughly confused


$addr_spec = '([^\\x00-\\x20\\x22\\x28\\x29\\x2c\\x2e\\x3a-\\x3c'.

$email = "real@email.com - notavalid.email";

$output = preg_match_all("!^$addr_spec$!", $email);

echo $output;


I'm getting some wild expression errors on this one.