I have some experience in using regular expressions in Perl, and have been
able to use preg_match in php, but am having a problem with preg_match_all.
I'm trying to extract data from an HTML table. Here's my preg_match call
that correctly grabs the 1st row of data in the table. It grabs 4 columns of
data:
preg_match("|<tr
class=\"CART_TD_REG\".+?<td.+?>(.*?)<.+?<td.+?>(.*?)<.+?<td.+?>(.*?)<.*?<inp
ut.*?>[ ]*(.*?)</td>.*?</tr>|", $res, $match);
If I use preg_match_all on the same table:
preg_match_all("|<tr
class=\"CART_TD_REG\".+?<td.+?>(.*?)<.+?<td.+?>(.*?)<.+?<td.+?>(.*?)<.*?<inp
ut.*?>[ ]*(.*?)</td>.*?</tr>|", $res, $match, PREG_PATTERN_ORDER);
...and try to print output, I get:
$match[0] = Array
$match[0][0] = Array[0]
$match[1][0] = Array[0]
$match[0][1] = Array[0]
$match[1][1] = Array[0]
Same result with PREG_SETORDER.
What am I doing wrong?
--
Randall Perry
sysTame
Xserve Web Hosting/Co-location
Website Development/Promotion
Mac Consulting/Sales
http://www.systame.com/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php