文字列内にある、URL を抜き出す、URI.extract、
または、正規表現のURI.regexp は、

Ruby 2.2 から obsolete になっているけど、
それに代わるものは、何ですか?

require 'uri'

URI.extract("文字列", ['http','https'] )

p URI.regexp =~ "http://www.ruby-lang.org/"; #=> 0