fork download
  1. <?php
  2.  
  3.  
  4. $text = "sdfsdjfl ds+fdd@gmail.syka-mail.su asdasdasdas, fsdf df ksdpf sjlgkjsd, sdfjsdkfsd.
  5. Jdsfsdfjklsd dsfds sd fds - dsfdsf, dfdda@com. sdada+s@some.domain-domain.com";
  6.  
  7. $regexp = '/([a-zA-Z0-9+_.-]+)@([a-z.-]+)/';
  8. $matches = [];
  9.  
  10. $counts = preg_match_all($regexp, $text, $matches);
  11. echo "Finded {$counts} mails\n";
  12.  
  13. foreach ($matches[0] as $mail) {
  14. echo "{$mail}\n";
  15. };
  16.  
Success #stdin #stdout 0.01s 82944KB
stdin
Standard input is empty
stdout
Find 3 mails
ds+fdd@gmail.syka-mail.su
dfdda@com.
sdada+s@some.domain-domain.com