I'm using this code to parse out emails from a string:
function get_emails ($str) {
    $pattern = '/([a-z0-9])(([-a-z0-9._])*([a-z0-9]))*\@([a-z0-9])' .
    '(([a-z0-9-])*([a-z0-9]))+' . '(\.([a-z0-9])([-a-z0-9_-])?([a-z0-9])+)/i';
    preg_match ($pattern, $str, $matches);
    return $matches;
}
It works well except when the address has more than one period in domain. So johndoe@yahoo.com works fine but johndoe@yahoo.co.uk get's cut at johndoe@yahoo.co
What can I change to fix this?
Thanks!
 
    