fork(1) download
  1. <?php
  2.  
  3. $regexp = "#from\s(.+?)\s(.+)#";
  4.  
  5. $data = "from sender.domainemail.net (this is comment) (this is another comment) (last comment)";
  6.  
  7. $matches = [];
  8.  
  9. preg_match($regexp, $data, $matches);
  10.  
  11. var_dump($matches);
Success #stdin #stdout 0.02s 24144KB
stdin
Standard input is empty
stdout
array(3) {
  [0]=>
  string(86) "from sender.domainemail.net (this is comment) (this is another comment) (last comment)"
  [1]=>
  string(22) "sender.domainemail.net"
  [2]=>
  string(58) "(this is comment) (this is another comment) (last comment)"
}