$re = '/^(.*?)/(.*?),now\s(.*?)\s(.*?)\s/';
$str = 'usbmuxd/kali-rolling,now 1.1.0-2+b1 amd64 [installed,automatic]
usbutils/kali-rolling,now 1:007-4 amd64 [installed]
util-linux/kali-rolling,now 2.28-6 amd64 [installed]
uuid-runtime/kali-rolling,now 2.28-6 amd64 [installed,automatic]
va-driver-all/kali-rolling,now 1.7.1-2 amd64 [installed,automatic]
vboot-kernel-utils/kali-rolling,now 0~R52-8350.B-1 amd64 [installed,automatic]
vboot-utils/kali-rolling,now 0~R52-8350.B-1 amd64 [installed,automatic]
vdpau-driver-all/kali-rolling,now 1.1.1-3 amd64 [installed,automatic]
';
preg_match_all($re, $str, $matches, PREG_SET_ORDER, 0);
// Print the entire match result
var_dump($matches);
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for PHP, please visit: http://php.net/manual/en/ref.pcre.php