title: PHP search a string for a email address
body: <p>Hi Im attempting to search a string to see whether it contains a email address - and then return it.</p>
  
  <p>A typical email vaildator expression is:</p>
  
  <pre><code>eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email);
  </code></pre>
  
  <p>However how would I search if that is in a string, for example return the email address in the string:</p>
  
  <p>"Hi my name is Joe, I can be contacted at joe@mysite.com. I am also on Twitter."</p>
  
  <p>I am a bit stumped, I know I can search if it exists at all with \b around it but how do I return what is found.</p>
  
  <p>Thanks.</p>