lrlebron@gmail.com
9/2/2007 1:31:00 PM
On Sep 2, 6:59 am, Robert Klemme <shortcut...@googlemail.com> wrote:
> On 02.09.2007 01:03, lrleb...@gmail.com wrote:
>
> > On Sep 1, 3:50 pm, Phil <cmdjackr...@googlemail.com> 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')
> => #<URI::Generic:0x3ffa0eda URL:foo.bar/baz?x=2>
> irb(main):003:0> u.query
> => "x=2"
> irb(main):004:0> u=URI.parse('baz?x=2')
> => #<URI::Generic:0x3ff9f15c URL:baz?x=2>
> irb(main):005:0> u.query
> => "x=2"
>
> Cheers
>
> robert
I meant if you try to parse the string
str = "<a href='showmono.asp?cpnum=555&monotype=full' target='main'>"
it throws an error.
c:/ruby/lib/ruby/1.8/uri/common.rb:432:in `split': bad URI(is not
URI?): <a href='showmono.asp?cpnum=555&monotype=full' target='main'>
(URI::InvalidURIError)
from c:/ruby/lib/ruby/1.8/uri/common.rb:481:in `parse'
from uritest.rb:8