PHP קוד:
<?php
$text = 'i am just testing something@tt.com i am just testing some more more@testing.com';
$text = preg_replace_callback( "#[a-zA-Z0-9_.-]+@[a-zA-Z0-9-]+.[a-zA-Z0-9-.]+#" , 'strip_non_emails', $text );
function strip_non_emails( $matches = array() )
{
print_r($matches);
}
?>
זה יכניס למערך את כל האימיילים שהוא מצא בתוך טקסט