It looks like...';
$pattern1 = '/Regular Standings/';
$pattern2 = '/ysptblthbody1/';
$pattern3 = '/\"\/mlb\/teams\/(.*)\"/';
$ii = 0;
$jj = 0;
$kk = 0;
for ($ii = 0; $ii < count($r); $ii++) {
$line = $r[$ii];
// Regular Standings
if (preg_match($pattern1, $line, $match)) {
$ii++;
for ($jj = $ii; $jj < count($r); $jj++) {
$line = $r[$jj];
// table top
if (preg_match($pattern2, $line, $match)) {
$jj++;
$output .= '
';
$output .='';
$output .='';
$output .=' | W';
$output .=' | L';
$output .=' | Pct';
$output .=' | GB';
$output .=' |
';
for ($kk = $jj; $kk < count($r); $kk++) {
$line = $r[$kk];
if (preg_match($pattern2, $line, $match)) {
break;
} else if (preg_match($pattern3, $line, $match)) {
if (preg_match('/([A-Z][A-Z]?[a-z]*\s?)+/', $line, $match)) {
$name = $match[0];
}
$output .= '';
$output .= ''. $name . ' | ';
$output .= $r[$kk + 1];
$output .= $r[$kk + 2];
$output .= $r[$kk + 3];
$output .= $r[$kk + 4];
$output .= '
';
}
}// for kk
$output .= '
';
}// pattern2
}// for jj
}// pattern1
}// for ii
print $output;
?>