SyntaxFix
Write A Post
Hire A Developer
Questions
it can also be achieved with below code
import re text = 'how are u? umberella u! u. U. U@ U# u ' print (re.sub (r'[uU] ( [^a-z] )', r' you\1 ', text))
or
print (re.sub (r'[uU] ( [\s!,.?@#] )', r' you\1 ', text))