orig = "here is some text", repl = "<FOO&BAR \q \ \\ \& \\& \\\&>"
result is "here is <FOOsomeBAR \q \ \ & \some \&> text"