From: Tj Superfly Date: 2008-01-28T01:34:48+09:00 Subject: Re: Extracting Data from a Webpage > This should be more efficient: > > require 'open-uri' > > url = "http://www.google.com" > title_re = Regexp.new(/(.*)<\/title>/) > text_re = Regexp.new(/type=(.{5})/) > > open(url) do |f| > f.each do |line| > if md_obj = title_re.match(line) > puts md_obj[1] > end > > if md_obj = text_re.match(line) > puts md_obj[1] > break > end > > end > end > > --output: > Google > hidde #first 5 chars of 'hidden' I receive this eror message when trying this code. DENTIFIER, expecting $end endndndreakmd_obj[1]_re.match(line))/title>/) Any suggestions? I did try the other clip of code posted here, but got more errors than this one. =/ I'm reading up on that link posted in the 2nd post to see if I can figure any of this out. Thanks. -- Posted via http://www.ruby-forum.com/.