Author: Jonas John, http://codedump.jonasjohn.de/
<?php
/*
** Function: extract_emails (PHP)
** Desc: This function extracts all E-Mail adresses from a given string, and returns them as array.
** Author: Jonas John
*/
function extract_emails($str)
{
// This regular expression extracts all emails from
// a string:
$regexp = '/([a-z0-9_\.\-])+\@(([a-z0-9\-])+\.)+([a-z0-9]{2,4})+/i';
preg_match_all($regexp, $str, $m);
return isset($m[0]) ? $m[0] : array();
}
?>
0 Comments:
Post a Comment