title: preg_replace all <img> parameters
body: <p>I've upgraded a WYSIWYG editor from an old version to the newest. There is a difference to how image dimensions are saved. The old version of the editor used to add width and height parameters to the image tag. The new editor creates a style parameter and adds width and height as a style.</p>
  
  <p>I have a preg_replace function that I use so that I can wrap an <code>&lt;a&gt;</code> tag around the <code>&lt;img&gt;</code>.</p>
  
  <p>The current preg_replace doesn't work anymore since the new editor saves width and height in the style parameter.</p>
  
  <p>Preg replace: </p>
  
  <pre><code>$Content = preg_replace('#&lt;img(.*?)src="([^"]*/)?(([^"/]*)\.[^"]*)"([^&gt;]*?)&gt;((?!&lt;/a&gt;))#', '&lt;a rel="group" class="fancybox fancy" title="" href="$2$3"&gt;&lt;img$1src="$2$3"&gt;&lt;/a&gt;', $Content);
  </code></pre>
  
  <p>If good to know, the new editor stores images like this:</p>
  
  <pre><code>&lt;img alt="" src="" style="" /&gt;
  </code></pre>
  
  <p>Whereas the old editor stored images like this:</p>
  
  <pre><code>&lt;img src="" width="404" height="228" alt="" /&gt;
  </code></pre>
  
  <p>How can I refactor my preg_replace to copy the complete style element as well? Backwards-compatibility would be cool too.</p>
  
  <p>Thanks for your time :)</p>