I have a list of strings in lst
lst = ["-", "/", ","]
Examples for str to re.sub:
str = "abc - abc 9-4 " => "abc abc 9-4 "
str = "abc , abc 9/4 " => "abc abc 9,4 "
str = "abc / abc 9,4 " => "abc abc 9/4 "
I want to replace all the matches for the given pattern with the string replace_with
I would like to implement it as follows
new_str = re.sub(pattern,replace_with, str);
where,
replace_with = ""
pattern = Please help me define the following in regex
(not number)(anything)(any of the strings in lst) (anything)(not number)