Mar-21-2020, 09:33 AM
I need to capitalize letters that go after a exclamation or question mark and an space.
So this:
'Are you there? yes! perfect'
becomes to this:
'Are you there? Yes! Perfect'
I manage to find them with this pattern ([!?])\s[a-z] but i dont know what to put in the replace so that just the letter become uppercase/capitalize
So this:
'Are you there? yes! perfect'
becomes to this:
'Are you there? Yes! Perfect'
I manage to find them with this pattern ([!?])\s[a-z] but i dont know what to put in the replace so that just the letter become uppercase/capitalize
pattern = '([!?])\s[a-z]' replace = '' new_string = re.sub(pattern, replace, text_2) print(new_string)Thank you for your help! :)