login
Blurts on the Art of Software Development

Today | RSS | RDF | Atom | Other Tags
Categories : All | All | CI | .NET | General | Humour | Java | Personal | Reviews | Ruby | SW Eng

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.


Links is not owrking
Oops. Fixed.

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)

Ah, a challenge indeed. And a one that I knowingly simplified with the purpose of making the goal attainable with my limited time available. There's a whole a lot of stuff in the RFCs that I didn't even take a look at, let alone implement.


Add a comment

Title
Body
HTML : b, i, blockquote, br, p, pre, a href="", ul, ol, li
Math Quiz 4 + 3 = (Helps stop blog spam)
Name
E-mail address
Website
Remember me Yes  No 

E-mail addresses are not publicly displayed, so please only leave your e-mail address if you would like to be notified when new comments are added to this blog entry (you can opt-out later).

TrackBack to http://radio.javaranch.com/lasse/addTrackBack.action?entry=1125247364021