Skip to content

Instantly share code, notes, and snippets.

@jdesilvio
Created June 6, 2015 16:06
Show Gist options
  • Save jdesilvio/c467091df2c1ace30ca6 to your computer and use it in GitHub Desktop.
Save jdesilvio/c467091df2c1ace30ca6 to your computer and use it in GitHub Desktop.
Simple script to verify URLs (for use in Rails apps)
#!/usr/bin/ruby
require 'uri'
#enter URL here
url = 'https://www.google.com'
#verify URL
if url =~ /\A#{URI::regexp(['http', 'https'])}\z/
puts “URL Verified"
else
puts “URL Invalid"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment