I'm retrieving raw text (includes header, and message) from a POP server. I need to capture everything after the header which is terminated by a blank line between it and the user message.
At the same time I'm wanting to ignore anything from original messages if it's a reply. The start of a reply for the emails I'm parsing start with
------Original Message------
An example email might look like this
Return-Path: ...
...
More Email Metadata: ...Hello from regex land, I'm glad to hear from you.
------Original Message------
Metadata: ...
...Hey regex dude, can you help me? Thanks!
Sincerely, Me.
I need to extract "Hello from regex land, I'm glad to hear from you." and any other text/lines prior to the original message.
I'm using this regex right now (C# in multiline mode)and it seems to work except it's capturing ------Original Message------ if the body is blank. I'd rather just have a blank string instead.
^\s*$\n(.*)(\n------Original Message------)?
Edit
I haven't down voted anyone and if you happen to downvote, it's usually helpful to include comments.