Unsafe characters such as '?' are breaking merge

Escaping the replaced url before using it as a regex search avoids unsafe characters breaking the replacing of the old URL with the new URL.