Need a RegEx to match subject in bounced email header
I'm trying to use a regular expression to match the subject of a bounced
email by looking in the header. I need to extract "Membership Activation"
from this email header:
Received: from DOMAIN.mydomain.com (UnknownHost [127.0.0.1]) by
DOMAIN.mydomain.net with SMTP;
Fri, 6 Sep 2013 10:34:07 -0600
Date: Fri, 6 Sep 2013 10:34:07 -0600 (MDT)
From: "MyDomain.com"
To: test@anotherdomain.com
Message-ID: <8279725.100.1378485247161.JavaMail.MYDOMAIN$@127.0.0.1>
Subject: Membership Activation
MIME-Version: 1.0
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 7bit
I tried:
^Subject: (.+)$
But ^ and $ don't work because these are CRLFs. Then I tried:
[\r\n]+Subject: ((.[^\r\n])+)
But I'm not getting the last "n" of "Membership Activation" in group 2 of
the result. I'm not sure if my negation of the CRLF is correct.
Any ideas?
No comments:
Post a Comment