Don't use regex for these kind of things, try a DOM parser such as SimpleHTMLDom.
<?php
require_once('simple_html_dom.php');
echo file_get_html('http://www.google.com/finance')->find('#markets', 0);
?>
Yeah... it's that easy :)
edit:
In response to your comment, behold the awesomeness of SimpleHTMLDom:
<?php
require_once('simple_html_dom.php');
$html = file_get_contents('http://www.google.com/finance');
$tidy = tidy_parse_string($html);
$tidy->cleanRepair();
$html = str_get_html((string)$tidy);
foreach($html->find('#markets .quotes', 0)->find('tr') as $line) {
printf("%s - %s - %s %s<br />",
$line->find('.symbol a', 0)->innertext,
$line->find('.price span', 0)->innertext,
$line->find('.change span', 0)->innertext,
$line->find('.change span', 1)->innertext);
}
?>
Yeah, I had to use Tidy for that page... I don't know who Google hired to do that HTML but it's absolutely horrendous. Unclosed td's, multiple elements with same id's etc... Parser choked on those :(