i do hate this regexp strings - cause i cant understand it :glare:
in your case i would use the good and old brute force:
<td width="anything" colspan="whatever" class="phone">123123</td>
<td width="anything" colspan="whatever" class="state">zz</td>
use
$aFile = file('somefile.html');
for ($i=0;$i<count($aFile); $i++) {
$aParts = explode('class="', $aFile[$i]);
if (!aParts[1]) {
// There is no such string in this line
continue;
}
// now $aParts[1] contains phone">123123</td>
$aParts = explode('"', $aParts[1]);
// now $aParts[0] contains phone
$sColName = $aParts[0];
// and $aParts[1] contains >123123</td>
$aParts = explode('>', $aParts[1]);
// $aParts[1] is 123123</td>
$aParts = explode('<', $aParts[1]);
$sValue = $aParts[0]; // wich contains 123123
echo $sColName . ' is ' . $sValue . '<br>';
}
it may return:
phone is 123123
state is zz
good luck!