I have a function to extract all <div> from a html code. It gives med the div's id and content, so it can be treated in a function.
It is working very, but the problem is that I now have to get div's inside a div extracted also!
This is just fill <div id="foo2">This is a new block</div> This is more fill
How can I do that? I don't necessarily need the parent div, just the ones inside (not containing any child div's)
// Function to extract div's from HTML code
$pattern = '/(<div.*?id="([a-z09_]+)".*?>)(.*?)<\/div>/ise';
$replacements = get_div_content("$1", "$2", "$3");
$proccesed_html = preg_replace($pattern, $replacement, $html);