From: Gene Tani Date: 2006-01-12T01:43:05+09:00 Subject: Re: Finding a sentence (more than one word & punctuation (, . ;)) in a string? Kev Jackson wrote: > given this string > > " message the message > to echo. Yes, unless data is > included in a character section within this element. " > > how can I get this result > > ["message", "the message to echo.", "Yes, unless data is included in a > character section within this element."] > > ? > > I've tried scan + regexp, but the best I've got so far is > > [["message"]] > > with this > > r.scan(/\">(\w+\s*)<\/td>/) > > Thanks > Kev if this is an HTML table extraction thing, rubyful soup is the easiest way to do it http://www.crummy.com/software/RubyfulSoup/documentation.html there's also the htmltokenizer.getText() method, (which i just now discovered by googling) which allows you to extract from before 1 tag at a time http://htmltokenizer.rubyforge.org/doc/ http://htmltokenizer.rubyforge.org/doc/