From: Sam Kong Date: 2005-05-11T01:00:27+09:00 Subject: Re: How to extract texts from html source? Tom Reilly wrote: > Several years ago, one of the members of the group offered me this > routine which does a pretty good job of > extracting the text from a html page. > > #-------------------------------------------------------------------- > # Strip HTML Tags from Line > #-------------------------------------------------------------------- > > def striphtml(line) > line.gsub(/\n/, ' ').gsub(/<.*?>/, '') > end Thank you for sharing the code. However, this code works only for a simple line, right? When I tested it with a page of html by looping line by line, the result was not what I expected. Probably, I need to get a DOM parser...:-( Sam