Last active
August 29, 2015 14:09
-
-
Save abriemme/010e2ecfdac5c49f024d to your computer and use it in GitHub Desktop.
Email reply parser (python) fr+en
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
REPLY_SPLITTER_REG = re.compile(r"^From:\s*[a-zA-Z0-9.\+_-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}|^From:\s.*\[mailto:[a-zA-Z0-9.\+_-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}\]|^On\s.*\s<[\s|][a-zA-Z0-9.\+_-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}>[\s|]wrote:$|^On\s.+?wrote:$|^Le\s.*\s<[\s|][a-zA-Z0-9.\+_-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}>[\s|]a\sécrit\s:$|^Le\s.+?a\sécrit\s:$|^.*<[a-zA-Z0-9.\+_-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}>.*$|^-+[\s|]Message\stransféré[\s|]-+$|^-+[\s|]Original\s+Message[\s|]-+$|^-+[\s|]Reply Message[\s|]-+$|^Sent.*from.*my.*|^envoyé\s+depuis\s+mon.*| ^envoyé\s+de\s+mon.*|^" + 'reply above this line' + "|^↑ Merci de répondre par dessus cette ligne ↑$|^-- $|^>\s|^[-|_]{3,}$|^\*{5,}DISCLAIMER\*{5,}$|^—$", re.I | re.M) | |
#try it here : http://regex101.com/r/oE7sC7/3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment