fork download
  1. <?php
  2. $text = "Мыло раз victory1@gmail.com
  3. мыло два failure13@yahoo.com
  4. agent@007.example.com
  5. ";
  6. $regexp = "/[a-z0-9_+.-]+@[a-z.-]+/i";
  7. $emails = array();
  8. $count = preg_match_all($regexp, $text, $emails);
  9. for ($i = 0; $i < $count; $i++) {
  10. echo $emails[0][$i] . "\n";
  11. }
  12.  
Success #stdin #stdout 0.02s 52472KB
stdin
Standard input is empty
stdout
victory1@gmail.com
failure13@yahoo.com