Posted By

focal55 on 03/15/12


php strings pregmatch

Versions (?)

Who likes this?

1 person have marked this snippet as a favorite


PHP: Find Email in String

 / Published in: PHP

Thank you Jonathan Sampson for posting this on

  1. <?php
  2. $content = "Hi my name is Joe, I can be contacted at [email protected]";
  3. preg_match("/[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})/i", $content, $matches);
  4. print $matches[0];
  5. ?>

Report this snippet  

You need to login to post a comment.