Extracting text

Here’s one answer to your question. Watch out, almost any change to
the input will break it.

irb(main):012:0> s = “Some text”
“Some text”
irb(main):013:0> m = %r{<TD [^>]+>([^<]+)}.match(s)
#MatchData:0x276f978
irb(main):014:0> p m[1]
“Some text”
nil
irb(main):015:0>

···

On Fri, 11 Jul 2003 07:46:44 -0400, “Dan” falseflyboy@yahoo.comNONO wrote:

I have a HTML table which I would like to extract text inside a . For an
example

Some text

I can write a code that detects the beginning of TD…
print line ~= “”

But how do I make it stop at . In the code above, I just want to print
“Some text”

thanks