Forum Moderators: coopster

Message Too Old, No Replies

preg match help

         

FiRe

5:27 pm on Feb 2, 2007 (gmt 0)

10+ Year Member



I have a site the produces results like this:

<a href="/file/564547">Text here</a></td>

I need to be able to extract the number and text. Have tried this:

preg_match_all("/\<a href=\"\/file\/([^0-9])\"\>(.*)\<\/a\>\<\/td\>/", $data, $m);

and this:

preg_match_all("/\<a href=\"\/file\/([0-9])\"\>(.*)\<\/a\>\<\/td\>/", $data, $m);

but $m is always empty! Any help?

Psychopsia

8:13 pm on Feb 2, 2007 (gmt 0)

10+ Year Member



Try:

$pattern = '/<a href="\/file\/([0-9]+)">(.*?)<\/a><\/td>/';

[edited by: Psychopsia at 8:13 pm (utc) on Feb. 2, 2007]