我是NLP的新手,想要使用python re库来清理电子邮件。 我已在another post中查看了答案。但我仍然无法弄清楚为什么只过滤掉第一个模式。
cleantext = re.sub(r'^From .*\n', '', text, flags = re.MULTILINE)
cleantext = re.sub(r'^To .*\n', '', cleantext, flags = re.MULTILINE)
cleantext = re.sub(r'^Subject .*\n', '', cleantext, flags = re.MULTILINE)
提前感谢任何暗示!