Get the actual email message that the person just wrote, excluding any quoted text

后端 未结 6 1228
我寻月下人不归
我寻月下人不归 2020-12-23 17:34

There are two pre-existing questions on the site. One for Python, one for Java.

  • Java How to remove the quoted text from an email and only show the new text
6条回答
  •  长情又很酷
    2020-12-23 18:12

    I agree that quoted text or reply is just a TEXT. So there's no accurate way to fetch it. Anyway you can use regexp replace like this.

    $filteringMessage = preg_replace('/.*\n\n((^>+\s{1}.*$)+\n?)+/mi', '', $message);
    

    Test https://regex101.com/r/xO8nI1/2

提交回复
热议问题