title: Getting only last sent message from forwarded email message using regex in php
body: <p>I need to parse email content of the forwarded message. I need to classify the email messages into two categories: </p>
  
  <ol>
  <li>Primary Content (The most recent message of the email)</li>
  <li>Secondary content (All other messages of the email)</li>
  </ol>
  
  <p>Here is my email content:</p>
  
  <pre><code>---------- Forwarded message ----------
  From: Khalil Ahmad &lt;otheremail@gmail.com&gt;
  Date: Fri, May 12, 2017 at 10:27 AM
  Subject: Re: Discussion
  To: Hammad Rasheed &lt;myemail@gmail.com&gt;
  
  
  ok no problem
  
  On Fri, May 12, 2017 at 10:26 AM, Hammad Rasheed &lt;myemail@gmail.com&gt;
  wrote:
  
  &gt; Great.
  &gt;
  &gt; I just want to check how this reply thing works
  &gt;
  &gt; On Fri, May 12, 2017 at 10:23 AM, Khalil Ahmad &lt;otheremail@gmail.com&gt; wrote:
  &gt;
  &gt;&gt; yup fine
  &gt;&gt;
  &gt;&gt; On Fri, May 12, 2017 at 10:23 AM, Hammad Rasheed &lt;myemail@gmail.com&gt;
  &gt;&gt; wrote:
  &gt;&gt;
  &gt;&gt;&gt; Hi,
  &gt;&gt;&gt;
  &gt;&gt;&gt; How are you doing?
  &gt;&gt;&gt;
  &gt;&gt;
  &gt;&gt;
  &gt;
  &gt;
  &gt; --
  &gt; ---------------------------------------------------------------
  &gt; Hammad Rasheed
  &gt; Ph: 0332-123456
  &gt; myemail@gmail.com &lt;myemail@gmail.com&gt;
  &gt; Connect with me on Linkedin:
  &gt; http://www.linkedin.com/in/xxxxxxx
  &gt;
  
  -- 
  ---------------------------------------------------------------
  Hammad Rasheed
  Ph: 0332-12345852
  myemail@gmail.com &lt;myemail@gmail.com&gt;
  Connect with me on Linkedin:
  http://www.linkedin.com/in/xxxxxxx
  
  --001a114b102aa2bdb7054f4d014a
  </code></pre>
  
  <p>I was able to extract all the forwarded messages using the following regex: </p>
  
  <pre><code>preg_match_all('~^&gt;.*~m', $body, $secondary);
  </code></pre>
  
  <p>Now I need to the return message (last one) that was sent i.e "ok no problem" message that does not start with ">" character. But I am unable to make regex for that. </p>
  
  <p>Can anyone please help?</p>