From: David Masover Date: 2008-07-19T13:20:27+09:00 Subject: Re: Suggestions for a parsing strategy? On Friday 18 July 2008 22:38:43 Eric I. wrote: > s.scan(/(\w+)(\((.*?)\))?/).map { |root, junk, suffixes| This pattern looks really useful... Looking at the docs for scan, it looks like it can take a block. Which just leaves one question: Why isn't this an Enumerator in Ruby 1.9? I don't think the original meaning (of producing an array) is made much more difficult by the form s.scan(/.../).to_a And I suspect that it would most often be useful for things like #map, if not used in block form outright. Making it an Enumerator would be somewhat more efficient than building a whole array first -- and more responsive, if it's a large string.