Return to Snippet

Revision: 56190
at March 15, 2012 05:44 by focal55


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

Initial URL


Initial Description
Thank you Jonathan Sampson for posting this on http://stackoverflow.com/questions/2050789/php-search-a-string-for-a-email-address

Initial Title
PHP: Find Email in String

Initial Tags
php

Initial Language
PHP