fork download
  1. <?php
  2.  
  3. $s = <<<INPUT
  4. Foreigners is still taking the decision on Your case. Thus today 04.10.2018, we
  5. sent a written request about the phase; for sacri.subba@yahoo.com;
  6. text text text ... for today you; other e-mail test@mai.com
  7. for another###test@mai.com
  8. INPUT;
  9. if (preg_match_all('~\bfor\s+\K\S+@\S+\.\S+\b~u', $s, $matches)) {
  10. print_r($matches[0]);
  11. }
Success #stdin #stdout 0s 82624KB
stdin
Standard input is empty
stdout
Array
(
    [0] => sacri.subba@yahoo.com
    [1] => another###test@mai.com
)