From: "lrlebron@..." Date: 2007-09-02T22:35:06+09:00 Subject: Re: Parsing query parameters from hyperlink On Sep 2, 6:59 am, Robert Klemme wrote: > On 02.09.2007 01:03, lrleb...@gmail.com wrote: > > > On Sep 1, 3:50 pm, Phil wrote: > >> lrleb...@gmail.com wrote: > >>> This would work if the string where a proper url. But it is a > >>> hyperlink. > >> Your point? A hyperlink *is* a URL in the WWW context. > > >> -- > >> Phillip Gawlowski > > > If you try to parse URI throws an error. > > Does it? This works for me: > > irb(main):001:0> require 'uri' > => true > irb(main):002:0> u=URI.parse('foo.bar/baz?x=2') > => # > irb(main):003:0> u.query > => "x=2" > irb(main):004:0> u=URI.parse('baz?x=2') > => # > irb(main):005:0> u.query > => "x=2" > > Cheers > > robert I meant if you try to parse the string str = "" it throws an error. c:/ruby/lib/ruby/1.8/uri/common.rb:432:in `split': bad URI(is not URI?): (URI::InvalidURIError) from c:/ruby/lib/ruby/1.8/uri/common.rb:481:in `parse' from uritest.rb:8