fork download
  1. urls = ['http://i...content-available-to-author-only...e.com/a.jpg',
  2. 'https://i...content-available-to-author-only...e.com/a.jpg',
  3. 'ssh://image.com/a.jpg',
  4. 'http://i...content-available-to-author-only...e.com/a.jpeg',
  5. 'https://i...content-available-to-author-only...e.com/a.png',
  6. 'ssh://image.com/a.jpeg']
  7. reg = %r{\Ahttps?:\/\/.*\.(?:png|gif|jpe?g)\z}
  8. urls.each { |url|
  9. puts "#{url}: #{(reg =~ url) == 0}"
  10. }
Success #stdin #stdout 0.01s 6052KB
stdin
Standard input is empty
stdout
http://i...content-available-to-author-only...e.com/a.jpg: true
https://i...content-available-to-author-only...e.com/a.jpg: true
ssh://image.com/a.jpg: false
http://i...content-available-to-author-only...e.com/a.jpeg: true
https://i...content-available-to-author-only...e.com/a.png: true
ssh://image.com/a.jpeg: false