Just for the record, as I bumped into the issue today. I needed to replace / by \ to make a path and found this thread.
Escaping did not work, replace never saw "/".
Finally, this worked :
I know the topic is old, but I post to avoid others to waste time on a non working solution.