<p>I'm looking for a multiline regex that will match occurrences after a blank line.  For example, given a sample email below, I'd like to match "From: Alex".  <code>^From:\s*(.*)$</code> works to match any From line, but I want it to be restricted to lines in the body (anything after the first blank line).</p>

<pre>
Received: from a server
Date: today
To: Ted
From: James
Subject: [fwd: hi]

fyi

----- Forwarded Message -----
To: James
From: Alex
Subject: hi

Party!

</pre>

[{'answer_id': 67840, 'author': 'Sebastian Redl', 'author_id': 8922, 'author_profile': 'https://Stackoverflow.com/users/8922', 'pm_score': 0, 'selected': False, 'text': '<p>Writing complicated regular expressions for such jobs is a bad idea IMO. It\'s better to combine several simple queries. For example, first search for "\\r\\n\\r\\n" to find the start of the body, then run the simple regex over the body.</p>\n'}, {'answer_id': 67843, 'author': 'Loren Segal', 'author_id': 6436, 'author_profile': 'https://Stackoverflow.com/users/6436', 'pm_score': 3, 'selected': True, 'text': '<p>I\'m not sure of the syntax of C# regular expressions but you should have a way to anchor to the beginning of the string (not the beginning of the line such as ^). I\'ll call that "\\A" in my example:</p>\n\n<pre><code>\\A.*?\\r?\\n\\r?\\n.*?^From:\\s*([^\\r\\n]+)$\n</code></pre>\n\n<p>Make sure you turn the multiline matching option on, however that works, to make "." match \\n</p>\n'}, {'answer_id': 67862, 'author': 'gregmac', 'author_id': 7913, 'author_profile': 'https://Stackoverflow.com/users/7913', 'pm_score': 0, 'selected': False, 'text': '<p>This is using a look-behind assertion. Group 1 will give you the "From" line, and group 2 will give you the actual value ("Alex", in your example).</p>\n\n<pre><code>(?&lt;=\\n\\n).*(From:\\s*(.*?))$\n</code></pre>\n'}, {'answer_id': 68031, 'author': 'Teetow', 'author_id': 10541, 'author_profile': 'https://Stackoverflow.com/users/10541', 'pm_score': 0, 'selected': False, 'text': '<pre><code>\\s{2,}.+?(.+?From:\\s(?&lt;Sender&gt;.+?)\\s)+?\n</code></pre>\n\n<p>The <code>\\s{2,}</code> matches at least two whitespace characters, meaning your first From: James won\'t hit. Then it\'s just a matter of looking for the next "From:" and start capturing from there.</p>\n\n<p>Use this with <code>RegexOptions.SingleLine</code> and <code>RegexOptions.ExplicitCapture</code>, this means the outer group won\'t hit.</p>\n'}]
['https://Stackoverflow.com/questions/67798', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/10392/']