replace string.translate with re.sub