From: dblack@...
Date: 2003-05-11T09:06:46+09:00
Subject: Re: Extracting text from HTML
Hi --
On Sun, 11 May 2003, Robo wrote:
> > Arg, line wrapping was too aggressive there...
> >
> > channelBlocks = Regexp.new(
> > '
',
> > Regexp::MULTILINE
> > )
>
> Thanks, just a slight problem, I want it to match from the start of the
> tag, but I think Ruby
> matched it with the last tag in the file.
That's why Kent told you to watch out for regex 'greed' :-)
If you change .* to .*? you should be in business.
> channelBlocks.each do |s|
> puts s
> end
Much simpler way to print an array:
puts channelBlocks
or
puts channel_blocks
(if you want to do your bit to preserve classic Ruby style :-)
David
--
David Alan Black
home: dblack@superlink.net
work: blackdav@shu.edu
Web: http://pirate.shu.edu/~blackdav