title: Use regex to extract recepient and sender from an email text in python
body: <p>I am learning regular expressions and am getting pretty frustrated with this. I have the following text:</p>
  <pre><code>From: sender name
  To: the recepient
  Subject: well done!
  Body: lorem ipsum lorem ipsum
  </code></pre>
  <p>I am trying to extract the text in the lines &quot;From&quot; and &quot;To&quot;. I wrote the following regex:</p>
  <p><code>(^From: [a-zA-Z]*)+|(^To: [a-zA-Z]*)+|(^Subject: [a-zA-Z])+</code></p>
  <p>and I'm matching it using this code:</p>
  <pre><code>regex = re.compile(pattern, flags=re.IGNORECASE | re.MULTILINE)
  result = regex.match(text).groups() 
  </code></pre>
  <p>but this is only matching the first line. I couldn't figure out what's wrong nor do I seem to understand how to write regular expressions correctly</p>