title: Regex: How do you get/extract information from an email using regular expressions (in ruby)?
body: <p>I'm trying to extract information from an email address like so in ruby:</p>
  
  <pre><code>Email: Joe Schmo &lt;joeschmo@abc123.com&gt;
  </code></pre>
  
  <p>to get these three variables:</p>
  
  <pre><code>name = ?
  email = ?
  domain = ?
  </code></pre>
  
  <p>I've tried searching everywhere but can't seem to find how to do it correctly. Here's what I have so far:</p>
  
  <pre><code>the_email_line = "Email: Joe Schmo &lt;joeschmo@abc123.com&gt;"
  
  name = (/^Email\: (.+) &lt;(.+)&gt;@[A-Z0-9.-]+\.(.+)/).match(the_email_line)[1]
  email = (/^Email\: (.+) &lt;(.+)&gt;@[A-Z0-9.-]+\.(.+)/).match(the_email_line)[2]
  domain = (/^Email\: (.+) &lt;(.+)&gt;@[A-Z0-9.-]+\.(.+)/).match(the_email_line)[3]
  </code></pre>
  
  <p>Any idea on how to get those three variables correctly?</p>