From: Robert Klemme Date: 2010-03-04T17:06:30+09:00 Subject: Re: Url parsing in ruby 2010/3/4 John Ydil : > Brian Candler wrote: >> John Ydil wrote: >>> my URL looks like http://localhost/mypage.rbx?var=nas002001 >> >>>> require 'rubygems' >> => true >>>> require 'rack' >> => true >>>> require 'uri' >> => false >>>> u = URI.parse("http://localhost/mypage.rbx?var=nas002001") >> => #> URL:http://localhost/mypage.rbx?var=nas002001> >>>> Rack::Utils.parse_query(u.query) >> => {"var"=>"nas002001"} >>>> > > I knew URI.parse but to use it, you need to know the URL. > In my case, i need to parse the URL in the web browser,in the address > bar, not a given URL. > Or maybe there's something a don't understand about how to use it. Maybe we should start over with you describing what you are trying to do. Your initial posting read like "I have an URL and need to extract a particular part of it". That's what Brian and I have answered. I'm afraid, you'll probably have to provide more context or explain where exactly you are stuck. Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/