title: Preg_replace or preg_replace_callback?
body: <p>I have links on some pages that use an old system such as:</p>
  
  <pre><code>&lt;a href='/app/?query=stuff_is_here'&gt;This is a link&lt;/a&gt;
  </code></pre>
  
  <p>They need to be converted to the new system which is like:</p>
  
  <pre><code>&lt;a href='/newapp/?q=stuff+is+here'&gt;This is a link&lt;/a&gt;
  </code></pre>
  
  <p>I can use preg_replace t0 change some of what i need to, but i also need to replace underscores in the query with +'s instead.  My current code is:</p>
  
  <pre><code>//$content is the page html
  $content = preg_replace('#(href)="http://www.site.com/app/?query=([^:"]*)(?:")#','$1="http://www.site.com/newapp/?q=$2"',$content);
  </code></pre>
  
  <p>What I want to do is run str_replace on the $2 variable, so I tried using preg_replace_callback, and could never get it to work.  What should I do?</p>