Alters a string by replacing multiple range fragments in one fast pass