Is it possible?
Basically, I want to turn these two calls into sub into one call:
re.sub(r'\bAword\b', 'Bword', mystring) re.sub(r'\baword\b', 'bword', mystring)
What I really liked is a kind of conditional substitution of type substitution:
re.sub(r'\b([Aa])word\b', '(?1=A:B,a:b)word')
I only like the capitalization of the first character. None of the others.
source share