Parsing an Email Message for just the reply, not the old thread?

Hello, I set my app to receive incoming emails via a post from a
service. The controller that receives the posts looks a little like

        class IncomingMailsController < ApplicationController
          require 'mail'
          skip_before_filter :verify_authenticity_token

          def create
            message =[:message])
            message_plain = (params[:plain])

            render :text => 'success', :status => 200 # a status of
404 would reject the mail

That successfully is delivering the entire email message,
replies,forward history etc. The issue is I'd like to be able to
extract just the actual reply text.

Currently I get:

    That's not a bad idea. Lets try that out.

In real life it will be a bit more complicated since that delineator isn't always the same. Sometimes it's what you have there "on such and such, so and so worte" and sometimes it's "--- Original Message" and sometimes it's something else. So you'll need to check for all the common ones and probably want the ability to see the entire message in case it messes up or in cases like this message where I've replied *below* that delineator.

But, for your case above assuming the plain text message is in a variable str then...

str.sub(/\A.*^\SOn \w+ \d+, \d+ at.* wrote:.*/m, '')

or something close to that ought to do it.