I am planning to use preg_replace to remove some unwanted stuff from dynamic string

$mystring:
<ul><li><a href="http://www.url.com/wiki/How_to_fix_erection_problems_after_prostate_surgery&amp;diff=335&amp;oldid=prev">How to fix erection problems after prostate surgery</a></li>
<li><a href="http://www.url.com/wiki/Wikipenis:Community_Portal&amp;diff=334&amp;oldid=prev">Wikipenis:Community Portal</a></li>
</ul>


This string is generated from an RSS reader. (The url has obviously been replaced to make sure no one thinks this is a spam post)

What I need to do is figure out a way to go through the string and remove the "&amp;diff=335&amp;oldid=prev" and the "&amp;diff=334&amp;oldid=prev"
I can not just use str_replace() because those two constantly change. However I assume it is possible with a regular expressions I just don't know regular expressions well enough to write one...but basically it needs to say something like:
preg_replace("&amp;diff=" and all characters in the middle to "=prev", "", $mystring);

I got this:
echo preg_replace("\&amp;diff.+?=prev", "", $mystring);

using this tool:
http://gskinner.com/RegExr/

But that gives me this error:
Warning: preg_replace() [function.preg-replace]: Delimiter must not be alphanumeric or backslash in /home/enhancement/www/www/index.htm on line 134

Oops forgot my delimeter...duh case closed

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.