From: Robert Klemme Date: 2010-01-29T06:40:19+09:00 Subject: Re: Regex or line.each seems to not be working. On 01/28/2010 08:45 PM, Roger Pack wrote: >> Perfect... Thanx man that did the trick.... Changed everything to >> "match" instead of "scan"... Keep a mental not on that. > > Believe it or not, I run into that one *all the time* > > Perhaps there should be an RCR for scan to return nil on no match? IMHO that would be inconsistent. Think about how SQL does it: if you query for one element, you get a result set with one element which can be NULL or a value != NULL. If you query for multiple elements you get a potentially empty result set. I believe the number of APIs that return collections and which return nil, null or NULL in case nothing is found is a minority. Btw, I usually use #scan with the block. In that case I don't really care about the return value of #scan. :-) Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/