I want to replace dashes which appear between letters with a space using regex. For example to replace ab-cd with ab cd
The following matc
You need to use look-arounds:
new_term = re.sub(r"(?<=[A-Za-z])-(?=[A-Za-z])", " ", original_term)
Or capturing groups:
new_term = re.sub(r"([A-Za-z])-(?=[A-Za-z])", r"\1 ", original_term)
See IDEONE demo
Note that [A-z] also matches some non-letters (namely [, \, ], ^, _, and `), thus, I suggest replacing it with [A-Z] and use a case-insensitive modifier (?i).
Note that you do not have to escape a hyphen outside a character class.