Replace image src attribute from HTML content
<p>I made a chrome extension that reads a page content and post it to my webserver. The problem is that I need to change the src attribute from the html source to my websites´s address.</p>

<p>Lets go to my code (this is just a example):</p>

<pre><code>$html = '&lt;p style="font-size: 12px; font-family: Tahoma; text-align: center;"&gt;&lt;img style="font-size: 12px; font-family: Tahoma;" src="http://sga.ufmg.br/images/uploads/13212/MSI_civil_01.png" alt="" width="338" height="367"&gt;&lt;/p&gt;';

$img = 'http://sga.ufmg.br/images/uploads/13212/MSI_civil_01.png';

$result = str_replace($img, 'http://asrespostazzz.com.br/questoes_img/' . $new_img_name, $html);
</code></pre>

<p>It simply wont work.... :(</p>

<p>I tried to use <code>preg_replace</code>, but gave me a error:</p>

<blockquote>
  <p>Message: preg_replace() [function.preg-replace]: Delimiter must not be alphanumeric or backslash</p>
</blockquote>