re = /.*(?<!_[0sml])\.jpg$/m
str = '9Uikt/ifehr54mg__0.jpg
9Uikt/idg4hdmg2_s.jpg
9Uikt/igdffgggfmg4_m.jpg
9Uikt/img3teg3gegg7_l.jpg
9Uikt/imgerhw45h70.jpg
9Uikt/imggq4ge37s.jpg
9Uikt/img3f37m.jpg
9Uikt/img34g3f7l.jpg
9Uikt/imgf3f34t4t73l_.jpg
9Uikt/imgf3f34t4t73l_2.jpg'
# 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