re = /^http\:\/\/[0-9]+|[a-z]+|[0-9][a-z]+|[a-z][0-9]+\.[a-z]+\/[a-z]+|[0-9]+|[0-9][a-z]+|[a-z][0-9]+\/[0-9]+|[a-z]+|[0-9][a-z]+|[a-z][0-9]+(?!\.jpg|jpeg|png|gif)/m
str = 'http://site234.com/folder/ar.txt
http://jtem.com/folder/s.zip
http://site.com/folder/ddr
http://sit23e1.ru/folder/eff.jpg
http://spbrecommender.com/folder/karo.gif
http://site.eu/folder/spb.pdf
http://site.com/folder/lego.jpeg
http://sir.fr/folder/some.jpg
http://site.com/folder/erro.exe
http://personel.com/folder/1.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