I need to extract the name and the e-mail from one data file. the file contains more than 500 lines and I want to extract this two informations almost all the data. I would like to use preg_match_all, but my function doesn't work ...
$chaine =
" -----------------
11/21/12 16:06:54 tcp static-qvn-qvt-127041
MAIL [email protected]
NAME tata1
-----------------
11/21/12 16:06:54 tcp static-qvn-qvt-127041
MAIL [email protected]
NAME tata2
* -----------------
11/21/12 16:06:54 tcp static-qvn-qvt-127041
MAIL [email protected]
NAME tata3
";
//$chaine =" #76:50#89:1#86:50#49:1#84:22";
$motif="/MAIL([a-z]{2,4}+)NAME([a-z]{2,4}+)/";
preg_match_all($motif,$chaine,$out);
$nb=count($out[0]);
for($i=0;$i<$nb;$i++)
{
echo $out[0][$i].'<br/>';
}