From: Ralph Mason Date: 2001-12-08T17:33:47+09:00 Subject: [ruby-talk:27906] Re: Dictionary.com speeder upper From: "Harry Ohlsen" > Any chance you could re-post the code without all the HTML around it? Sure, Sorry I didn't even know I was posting in HTML. > Damn I wish we could sort out this posting of HTML problem. I'm just > glad not too many people do it; it would be enough to stop me reading the > newsgroup. require "net/http" if ARGV.size == 0 puts "Usage: dictionary term" exit end a = Net::HTTP.get("www.dictionary.com","/cgi-bin/dict.pl?term=#{ARGV[0]}") if ( a=~/No entry found for/ ) puts "No entry found for '#{ARGV[0]}' - Suggestions:\n\n" while $' =~/(\w+)/ puts $1 end else while a =~ // $' =~ // a=$' puts $`.gsub(/<.*?>/m){ |i| case i when "" "" when "" "\n" when "

" "" else "" end } end end