I'm looking for a way to find a html div with a certain ID using php
<?php
$regex = "<div+[a-zA-Z0-9._-\"]+id=\"";
$string = '<html><body><div style="rubbish" id="man"></body></html>';
preg_match($regex, $string, $matches, PREG_OFFSET_CAPTURE);
$var_export = $matches;
$var = $var_export[1][1];
echo substr($string, $var, 3);
?>
I know this is a load of rubbish at the momment but I can't quite get my head around regular expressions.