Originally posted by pinkbird
Here is my problem. (see the code below)
...the literal $3 instead of the value that $3 represents, which is a url (I've tried \3 also and it doesn't work).
Well, $3 certainly won't work.
And because you're executing code within the replacement string, you'll want to use the /e modifier on your regexp.