re = /(.*:[\w]{2} )(.*)/
str = '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'
# Print the match result
str.scan(re) do |match|
puts match.to_s
end
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 Ruby, please visit: http://ruby-doc.org/core-2.2.0/Regexp.html