Get only http and https based url : URI « Network « Ruby






Get only http and https based url


require 'uri'

text = %{"test
<a href="http://www.example.com/">http://www.example.com/</a>, and be sure
to check out my weblog at http://www.example.com/blog/. Email me at <a
href="mailto:bob@example.com">b@e.com</a>.}


URI.extract(text, ['http', 'https'])

 








Related examples in the same category

1.Parsing URLs
2.Split a URL
3.URI::HTTP.component
4.URI::MailTo.component
5.Create a URL with URI::HTTP.build
6.Dump a URL
7.mailto URI parse
8.URI parse
9.Extracting All the URLs from an HTML Document