From: Robert Klemme Date: 2006-04-29T03:44:21+09:00 Subject: Re: Counting words 2006/4/28, Jamal Mazrui : > I've research this but am still having trouble getting it right .... > Can someone give me code that counts the number of words in a string via > RegExp and MatchData objects? I think I'd like a word to be defined as > contiguous characters surrounded by white space (or the start/end of the > string), though am open to other interpretations. s.scan(/\w+/).size -- Have a look: http://www.flickr.com/photos/fussel-foto/