Fix escaping in replace pattern