From: Max Williams Date: 2009-07-20T17:24:00+09:00 Subject: Re: Hpricot - strip out images and show first x words 7stud -- wrote: > Well, what does this say: > >> I have a bunch of html in p tags and i want to show shorted >> summary - like the first 25 words followed by '...'. I guess that was a bit ambiguous, sorry. Anyway, i'm interested to see you don't think it's worth bothering with hpricot in this case, and just use a regex - i was wondering if hpricot was overkill myself. One problem that just occurred to me is that treating the whole html like text and taking the first 25 words will make it into invalid html - because we have start tags with no matching end tags. So, ideally i would preserve the start and end tags and strip the content down to 25 words. That's why i used hpricot initially. Anyway, thanks for your help. max -- Posted via http://www.ruby-forum.com/.