From: "Marcel Molina Jr." Date: 2005-06-12T09:30:35+09:00 Subject: Re: how to extract url's from html source of google search result On Sun, Jun 12, 2005 at 03:44:03AM +0900, sujeet kumar wrote: > I want to make a Tk window where you give some input string and it > search that on google and prints the web address (http url) of the > result found on google in the TkFrame of that window. My program > connects to net and get the html source through function "http.get". > Now from html source , how can I find the url's of the search. Can i > do it by regular expression or any other way. > Give me any suggestion. The URI.extract method from the uri library can extract an array of uri's from a string: require 'uri' URI.extract('My favorite site is http://google.com') # => ["http://google.com"] An optional second argument can limit the schemes that it will match against and return: URI.extract('Why do people use mailto:me@lala.org links?') # => ["mailto:me@lala.org"] URI.extract('Why do people use mailto:me@lala.org links?', 'http') # => [] marcel -- Marcel Molina Jr.