Someone asked on the #ruby-lang IRC channel earlier today whether there's a utility somewhere for extracting URLs from a string. Since I only have a gazillion things I should've been doing, I decided to hack together some Ruby...
So, here's UrlRegex and a test for it.
If and when you find a flaw in the code, post a comment and I'll see if I can get myself to fix it ;)
UPDATE: I wasn't aware rafb.net's "paste" application loses old pastes that quickly. I've now uploaded the source code on this server.
Ah, a challenge.
Your scheme support seems wildly lacking. I can understand not supporting some of the stranger and less common ones, but you don't even support the likes of "mailto:" and "file:" which you probably see every day :)
A good working system should probably also support at least "telnet:", "callto:", "rtsp:", but future-proof systems should really support arbitrary schemes.
See the 2005 URI spec (RFC3986)







