re = /^(.*)_((?:x\d{1,4}|\d{1,4}x)(?:\d{1,4})?(?=\+|\.).*)\.(.+)/m
str = '/banner/tenis-15088083003831_x1000+crop_center+q_80+f_999+jpg.png
/banner/tenis-15088083003831_2200x9220+crop_center+q_80+F_999+jpg.png
/banner/tenis-1508_8083003831_200x+crop_center+q_80+f_999+jpg.png
/banner/tenis-15088_x21230_83003831_200x.png
/banner/tenis-15088083003831_200x100.png
/banner/tenis-15088083003831_x1000.png
http://cdn.dooca.com.br/melbenett.com.br/banner/tenis-1508808_3003831.png
http://cdn.dooca.com.br/melbenett.com.br/banner/tenis-1508808_123123x12312331.png'
# 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