#!/usr/bin/env ruby # This code comes from http://ruby-it.org/pages/Estrarre+URL # Check the page for copyright notice and explanations require "uri" URI.extract("bla bla baa http://foo.bar.com/foobar mailto:pippo@mai.com") #=> ["http://foo.bar.com/foobar", "mailto:foo@bar.com"]