$re = '/(\/.*:)/';
$str = '/system:
drwxr-xr-x 0 0 2017-04-01 09:15 app
drwxr-xr-x 0 2000 2017-03-30 20:53 bin
-rw-r--r-- 0 0 10911 2017-04-11 18:53 build.prop
drwxr-xr-x 0 0 2017-04-01 09:14 data-app
drwxr-xr-x 0 0 2017-06-05 22:01 etc
drwxr-xr-x 0 0 2017-03-30 20:53 fonts
drwxr-xr-x 0 0 2017-04-17 20:39 framework
drwxr-xr-x 0 0 2017-03-30 20:53 lib
drwxr-xr-x 0 0 2017-03-30 20:53 lib64
drwxrwx--- 0 0 2017-03-30 20:52 lost+found
drwxr-xr-x 0 0 2017-03-31 05:58 media
drwxr-xr-x 0 0 2017-04-01 09:16 priv-app
drwxr-xr-x 0 0 2017-03-30 20:54 rfs
drwxr-xr-x 0 0 2017-03-30 20:54 spaces
drwxr-xr-x 0 0 2017-03-30 20:54 usr
drwxr-xr-x 0 2000 2017-03-30 20:54 vendor
drwxr-xr-x 0 2000 2017-03-30 20:54 xbin
/system/app:
drwxr-xr-x 0 0 2017-03-30 20:52 AnalyticsCore
drwxr-xr-x 0 0 2017-03-30 20:52 AntHalService
drwxr-xr-x 0 0 2017-03-30 20:52 AntiSpam
drwxr-xr-x 0 0 2017-03-30 20:52 AppIndexProvider
drwxr-xr-x 0 0 2017-03-30 20:52 ApplicationsProvider
drwxr-xr-x 0 0 2017-03-30 20:52 AutoTest
drwxr-xr-x 0 0 2017-03-30 20:52 Bluetooth';
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