For example, if I want to add a space in-between all instances where I have one uppercase letter preceding a hyphen (A-, C-, etc...), then what function can I use to achieve this?
Alternatively, is there a way to get re.sub to output the pattern that was matched? :
>>> text = 'T- AB-'
>>> re.sub(r'\b[A-Z]-', 'what goes here?', text)
>>> text
'T - AB-'