title: Remove div and contents of given class in PHP
body: <p>I am using a javascript package called Medium Editor which allows you to replicate the Medium.com's text editor.</p>
  
  <p>To do this it adds a button into the content editable div with a class. This button has a + symbol and acts as the button for adding images etc.</p>
  
  <p>The issue is that when I am posting the content of that div it is also posting this div and contents.</p>
  
  <p>I wish to look for the div with the class and remove it before I run it through html purifier.</p>
  
  <p>This is an example of the HTML I wish to completely remove from the string:</p>
  
  <pre><code>&lt;div class="medium-insert-buttons" contenteditable="false" style="dislollay: none"&gt;\r\n
  &lt;a class="medium-insert-buttons-show"&gt;+&lt;/a&gt;\r\n
  &lt;ul class="medium-insert-buttons-addons" style="dislollay: none"&gt;\r\n
          &lt;li&gt;&lt;a data-addon="images" data-action="add" class="medium-insert-action"&gt;&lt;slolan class="fa fa-camera"&gt;&lt;/slolan&gt;&lt;/a&gt;&lt;/li&gt;\r\n
          &lt;li&gt;&lt;a data-addon="embeds" data-action="add" class="medium-insert-action"&gt;&lt;slolan class="fa fa-youtube-lollay"&gt;&lt;/slolan&gt;&lt;/a&gt;&lt;/li&gt;\r\n
  &lt;/ul&gt;\r\n
  </code></pre>
  
  <p></p>
  
  <p>I did find a few examples using Regex but they didn't work. Example being:</p>
  
  <pre><code>    $clean = preg_replace('#&lt;div class="medium-insert-buttons"&gt;(.*?)&lt;/div&gt;#', '', $request-&gt;feature_content);
  </code></pre>