improve escaping replacements to allow scriptbuilder to be escaped