Remove Email Signature - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: Remove Email Signature (/thread-17822.html) |
Remove Email Signature - NewBeie - Apr-25-2019 Hi, I have this text of emails and their signature" Quote:Good Morning I would like to go through the text and remove the signature, but the code should be flexible for any text of this nature. As soon as there's "King Regards or Vriendelike groete" it should see that that's a signature, maybe preceded by '\n'. I don't know if there's Library out there or Regex, I've been trying to playing around with it but succeeding. Quote:Good Morning RE: Remove Email Signature - Larz60+ - Apr-25-2019 What have you tried so far? RE: Remove Email Signature - NewBeie - Apr-29-2019 Hi, Thank you for the response, I actually have a pattern already, pattern = re.compile(r'[Kk]ind [Rr]egards|[Vv]riendelike [Gg]roete/|[Vv]riendelike [Gg]roete|[Bb]est [Rr]egards| [Bb]est [Rr]egards| [Yy]ours [Ss]incerely| \n [Rr]egards')But it only takes out the first part of the signature My question was more on the entire Signature, one of them include their names and numbers after 'Kind Regards': Quote:Vriendelike groete/ Kind regards But others doesn't, it's just this: Quote:Kind regards Is there a way or methods somewhere that maybe we can even edit, that tries to identify the signature? (Apr-25-2019, 06:17 PM)Larz60+ Wrote: What have you tried so far? RE: Remove Email Signature - Larz60+ - Apr-29-2019 Can't vouch for it, but found this package: https://github.com/mailgun/talon RE: Remove Email Signature - PythonPaul2016 - Jan-01-2020 Mailgun's Talon library is okay. It's not super accurate. SigParser's email parsing library is better in that it can handle multiple languages. |