<?php $regexp = "#from\s(.+?)\s(.+)#"; $data = "from sender.domainemail.net (this is comment) (this is another comment) (last comment)"; $matches = [];
Standard input is empty
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)"
}