Extract Emails from Text

Extract all email addresses from a text string.

Code

General
preg_match_all('/[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/', $text, $matches);
return $matches[0];

Parameters

Text containing emails

Server

More PHP Snippets