How do I extract all URLs from a plain text file in Ruby?
I tried some libraries but they fail in some cases. What\'s the best way?
If you like using what's already provided for you in Ruby:
require "uri"
URI.extract("text here http://foo.example.org/bla and here mailto:test@example.com and here also.")
# => ["http://foo.example.org/bla", "mailto:test@example.com"]
Read more: http://railsapi.com/doc/ruby-v1.8/classes/URI.html#M004495