If you are not wanting something so trivial as a replacement of -- or :: etc... and you really need to catch a particular pattern then I am not sure how it will work with the backreferences in a variable like $replacement.

The backreference's seem to be lost in translation, I tested some code and $1, $2 and $3 never contained anything when doing: