title: Preg replace image src using callback
body: <p>I have an article with HTML tags. It's a long article with 3/5 images. Now I want to update every image <code>src</code> attributes. Example: </p>
  
  <p>Image html tag looks like:</p>
  
  <pre><code>&lt;img class="aligncenter" style="display: block;margin-left:auto;margin-right:auto;" src="http://img.zszywka.com/0/0269/w_0980/moj-swiat/muza-2013-najnowsze-eska-hity-2013-.jpg" width="642" /&gt;
  </code></pre>
  
  <p>I want to take this URL, make some changes and next update <code>src</code>. Then go to next image and do it again (so script must change all images src) </p>
  
  <p>Final img tag looks like: </p>
  
  <pre><code>&lt;img class="aligncenter" style="display: block;margin-left:auto;margin-right:auto;" src="http://EXMAPLE.COM/0/0269/w_0980/moj-swiat/muza-2013-najnowsze-eska-hity-2013-.jpg" width="642" /&gt;
  </code></pre>
  
  <p>So I need to manipulate with changes. I try using <code>preg_replace_callback</code> but I have a problem with it: </p>
  
  <pre><code>// change image src
  
  
  $finalContent = preg_replace_callback('/' . preg_quote('src="(*.?)"') . '/', 
  function() use ($variable_with_changes){ return $variable_with_changes; }, $variable_with_article_content);
  
  echo $finalContent;
  </code></pre>
  
  <p>This doesn't works, I don't have an idea how I can update image domain and keep path.</p>