Page 1 of 1

preg_match_all problems

Posted: Wed Aug 24, 2005 12:30 am
by aff_dan
Hi Sirs,
I have this PHP code:

Code: Select all

// Output 
$s = $source->getSource(); 

if (preg_match_all('{<td><font face="verdana,sans-serif" size=(1¦2)\s?(color=E8E8E8)?>&nbsp;?([0-9]+?)</td>\n<td>(&nbsp;<a href="(.+?)">)?<font face="verdana,sans-serif" size=(1¦2) color=(#000000¦E8E8E8)>(&nbsp;)?(.+?)</a></td>}is', $s, $out, PREG_SET_ORDER)) { 

for($i=0;$i<count($out);$i++) { 
array_push($keywords, $out[$i][3].'~'.$out[$i][9]); 
}
using this PHP code to copy from an HTML source:

Code: Select all

<td><font face="verdana,sans-serif" size=1>&nbsp;53021</td> 
<td>&nbsp;<a href="?article=free&mkt=us"><font face="verdana,sans-serif" size=1 color=#000000>free</a></td> 
</tr>
My PHP code is wrong? Where is the wrong in my php code?

Please help

Regards,
Dan

Posted: Wed Aug 24, 2005 1:46 am
by feyd
first thing that jumps out is your pattern being invalid. You have the pattern enclosed in {}, whereas a pattern must be enclosed in the same exact symbols on both ends.