re = /(.*?),(.*?),'(.*?),'(.*?),'(.*?),'(.*?),(.*)/m
str = '2016/11/09,12:10:00,\'4355,\'4358,\'4346,\'4351,1,201
2016/11/09,12:09:00,\'4361,\'4362,\'4353,\'4355,1,117
2016/11/09,12:08:00,\'4364,\'4374,\'4359,\'4360,10,175
2016/11/09,12:07:00,\'4371,\'4376,\'4360,\'4365,590
2016/11/09,12:06:00,\'4359,\'4372,\'4358,\'4369,420
2016/11/09,12:05:00,\'4365,\'4367,\'4356,\'4359,542
2016/11/09,12:04:00,\'4379,\'1380,\'4360,\'4365,1,697
2016/11/09,12:03:00,\'4394,\'4396,\'4376,\'4381,1,272
2016/11/09,12:02:00,\'4391,\'4399,\'4390,\'4393,524'
# 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