Update replace with global,modifier regular express to ensure all improper CEND sequences are escaped.