[eluser]Rob Gordijn[/eluser]
hm, forgot what I said about adding an extra space for $replace.
Because it will work, but not if the $replace is founded at the end of $string (wich has no space at the end)
Look up the manual and some beginner tutorials about regular expressions, you will be amazed by it powers.
Someday regex will take over the world. lol