title: Php Remove div in html with a certain class name with regex
body: <p>I have some html to parse which contains multiple divs, tags, links and so on. I want to remove via PHP all the divs with a specific class name: "hide" (even if the div has multiple class names it must work).</p>
  
  <p>e.g.</p>
  
  <p><code>&lt;div class="hide"&gt;somecontents, some tags, some subdivs&lt;/div&gt;</code></p>
  
  <p>but also</p>
  
  <p><code>&lt;div class="row background upperdiv hide green"&gt;somecontents, some tags, some subdivs&lt;/div&gt;</code></p>
  
  <p>I've tried this regex:</p>
  
  <pre><code>$replacediv = "/(&lt;div[^&gt;]*class=\"(.*?)hide(.*?)\"[^&gt;]*&gt;*.*&lt;\/div&gt;)/i";
  $response = preg_replace($replacediv, '', $response);
  </code></pre>
  
  <p>But it doesn't work! Where am I wrong?</p>