...
How to match the html inside(including) I need a
Use DOM and DOMXPath instead of regex, you'll thank me for it:
// something useful:
function dumpDomNode ($node) {
$temp = new DOMDocument();
$temp->appendChild($node,true);
return $temp->saveHTML();
}
$dom = new DOMDocument();
$dom->loadHTML($html_string);
$xpath-> new DOMXpath($dom);
$elements = $xpath->query("*/div/[@class='begin']");
foreach ($elements as $el) {
echo dumpDomNode($el); // <-- or do something more useful with it
}
Trying this with regex will lead you down the path to insanity...