title: in PHP, how to remove specific class from html tag?
body: <p>given the following string in PHP:</p>
  
  <pre><code>$html = "&lt;div&gt;
  &lt;p&gt;&lt;span class='test1 test2 test3'&gt;text 1&lt;/span&gt;&lt;/p&gt;
  &lt;p&gt;&lt;span class='test1 test2'&gt;text 2&lt;/span&gt;&lt;/p&gt;
  &lt;p&gt;&lt;span class='test1'&gt;text 3&lt;/span&gt;&lt;/p&gt;
  &lt;p&gt;&lt;span class='test1 test3 test2'&gt;text 4&lt;/span&gt;&lt;/p&gt;
  &lt;/div&gt;";
  </code></pre>
  
  <p>I just want to either empty or remove any class that has "test2" in it, so the result would be this:</p>
  
  <pre><code>&lt;div&gt;
  &lt;p&gt;&lt;span class=''&gt;text 1&lt;/span&gt;&lt;/p&gt;
  &lt;p&gt;&lt;span class=''&gt;text 2&lt;/span&gt;&lt;/p&gt;
  &lt;p&gt;&lt;span class='test1'&gt;text 3&lt;/span&gt;&lt;/p&gt;
  &lt;p&gt;&lt;span class=''&gt;text 4&lt;/span&gt;&lt;/p&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>of if you're removing the element:</p>
  
  <pre><code>&lt;div&gt;
  &lt;p&gt;text 1&lt;/p&gt;
  &lt;p&gt;text 2&lt;/p&gt;
  &lt;p&gt;&lt;span class='test1'&gt;text 3&lt;/span&gt;&lt;/p&gt;
  &lt;p&gt;text 4&lt;/p&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>I'm happy to use a regex expression or something like PHP Simple HTML DOM Parser, but I have no clue how to use it.  And with regex, I know how to find the element, but not the specific attribute associated w/ it, especially if there are multiple attributes like my example above.  Any ideas?</p>