>>> import re >>> re.split(r"[.?!]", "One sentence. Another one? And the last one!")
['One sentence', ' Another one', ' And the last one', '']
Spliting strings using multiple separators and capturing the separators
>>> import re >>> re.split(r"([.?!])", "One sentence. Another one? And the last one!")
['One sentence', '.', ' Another one', '?', ' And the last one', '!', '']
Searching for specific string to mask it
>>> import re
>>> re.sub(r"[\w.%+-]+@[\w.-]+", "[REDACTED]","Received an email for go_nuts95@myexample.com")
'Received an email for [REDACTED]'