I have searched but cannot find a solution that works. I have tried using DOM but the result is not identical (different spaces and tag elements - minor differences but I need identical for further pattern searches on the source) to the source, hence I would like to try regex. Is this possible (I know it isn't best solution but would like to try it)? For example is it possible to return all of the div class "want-this-entire-div-class" including inner:
$html = '<div class="not-want">
<div class="also-not-want">
<div class="want-this-entire-div-class">
<button class="dropdown-toggle search-trigger" data-toggle="dropdown"></button>
<div class="dropdown-menu j-dropdown">
<div class="header-search">
<input type="text" name="search" value="" placeholder="Search entire site here..."
class="search-input" data-category_id=""/>
<button type="button" class="search-button" data-search-url="https://www.xxxxcom/index.php?
route=product/search&search="></button>
</div>
</div>
</div>
<div class="not-want-this-also">
<div class="or-this">';
The following stops after the first div>
preg_match('/<div class="want-this-entire-div-class"(.*?)</div>/s', $html, $match); Thanks