title: Strip all HTML attributes except for src
body: <p>I'm trying to remove all tag attributes except for the <code>src</code> attribute. For example:</p>
  <pre><code>&lt;p id=&quot;paragraph&quot; class=&quot;green&quot;&gt;This is a paragraph with an image &lt;img src=&quot;/path/to/image.jpg&quot; width=&quot;50&quot; height=&quot;75&quot;/&gt;&lt;/p&gt;
  </code></pre>
  <p>Would be returned as:</p>
  <pre><code>&lt;p&gt;This is a paragraph with an image &lt;img src=&quot;/path/to/image.jpg&quot; /&gt;&lt;/p&gt;
  </code></pre>
  <p>I have a regular expression to strip all attributes, but I'm trying to tweak it to leave in <code>src</code>. Here's what I have so far:</p>
  <pre><code>&lt;?php preg_replace('/&lt;([A-Z][A-Z0-9]*)(\b[^&gt;]*)&gt;/i', '&lt;$1&gt;', '&lt;html&gt;&lt;goes&gt;&lt;here&gt;');
  </code></pre>