I want to remove everything from the + up to the @, including the +, but not the @
The closest that I have been able to get is using this between regex.
>>> email = "[email protected]"
>>> re.sub(r'\+[^)]*\@', '', email)
garrygmail.com
Put @ in the replacement string, rather than an empty string.
re.sub(r'\+[^)]*@', '@', email)
BTW, there's no need to escape @.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With