re = /\d+_([^\/]+)/m
str = '\'source/108_cash_total/\',
\'source/108_customer/\',
\'source/108_daily_units_total/\',
\'source/108_discounts/\',
\'source/108_employee/\',
\'source/56_cash_total/\',
\'source/56_customer/\',
\'source/56_daily_units_total/\',
\'source/56_discounts/\',
\'source/56_employee/\']'
# 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