Forum Moderators: coopster

Message Too Old, No Replies

preg_match_all Question

preg_match_all problems

         

aff_dan

5:25 am on Aug 24, 2005 (gmt 0)

10+ Year Member



Hi Sirs,

I have this PHP code:

// 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:

<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

jatar_k

4:29 pm on Aug 26, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



I don't know the answer but I'll bump it for someone who does ;)

coopster

8:48 pm on Aug 29, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



The pattern in that preg_match_all function is a bit ... complex ... I guess is the best way to put it. Can you explain in plain language what you are trying to use for a pattern?