use re.sub, not str.replace, otherwise things like "$" dont work

This commit is contained in:
jesopo 2020-02-14 23:57:23 +00:00
parent 6e9c303fcd
commit c73570a953

View file

@ -35,7 +35,7 @@ class SedReplace(Sed):
for token in reversed(_tokens(replace_copy, "&")):
replace_copy = (
replace_copy[:token]+match.group(0)+replace_copy[token+1:])
s = s.replace(match.group(0), replace_copy, 1)
s = re.sub(self.pattern, replace_copy, s, 1)
return s
@dataclasses.dataclass