Validate URL

Check if a string is a valid URL.

Code

General
require 'uri'
return !!(url =~ URI::DEFAULT_PARSER.make_regexp(['http', 'https']))

Parameters

The URL to validate

Server

More Ruby Snippets