re = / .+\.rtf /
str = 'rxn of glucose.png Screen Shot 2017-07-17 at 8.25.30 AM.png Screen Shot 2017-08-18 at 11.23.21 AM.png Screen Shot 2017-08-18 at 11.36.27 AM.png Screen Shot 2017-08-19 at 6.06.19 AM.png SSS.rtf Untitled 2.rtf Untitled 3.rtf Untitled 4.rtf Untitled.rtf'
# 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