fork(2) download
  1. <?php
  2.  
  3. $regexp = "#\((.+?)\)| #";
  4.  
  5. $data = "from sender.domainemail.net (this is comment) (this is another comment) (last comment)";
  6.  
  7. $matches = preg_split($regexp, $data, -1, PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY);
  8.  
  9. var_dump($matches);
Success #stdin #stdout 0.02s 24192KB
stdin
Standard input is empty
stdout
array(5) {
  [0]=>
  string(4) "from"
  [1]=>
  string(22) "sender.domainemail.net"
  [2]=>
  string(15) "this is comment"
  [3]=>
  string(23) "this is another comment"
  [4]=>
  string(12) "last comment"
}