function extract_regex($subject, $regex, $index = 1)
{
preg_match_all($regex, $subject, $matches);
if (count($matches[$index]))
{
if (count($matches[$index]) == 1)
{
return trim($matches[$index][0]);
}
return $matches[$index];
}
return '';
}
$out = extract_regex("<label class="area"><font class="bg_info" onmouseover="land_convert_txt(this,3067)" onmouseout="tooltip_hide()">3,067 Sq. Ft.</font></label>","/<label class=\'area\'>(.*)<\/label>/i");
echo "<xmp>". $out . "</xmp>";
11
solved Regex scraper challenge [duplicate]