Use rx for regexps, and properly handle embedded escaped chars in strings