I have links on some pages that use an old system such as:
<a href='/app/?query=stuff_is_here'>This is a link</a>
They need to be converted to the new system which is like:
<a href='/newapp/?q=stuff+is+here'>This is a link</a>
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:
//$content is the page html
$content = preg_replace('#(href)="http://www.site.com/app/?query=([^:"]*)(?:")#','$1="http://www.site.com/newapp/?q=$2"',$content);
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?