From: GOTO Kentaro Date: 2001-11-09T14:37:09+09:00 Subject: [ruby-talk:24741] Re: Negate grep pattern match? In message "[ruby-talk:24738] Re: Negate grep pattern match?" on Fri, 9 Nov 2001 14:21:23 +0900, OZAWA -Crouton- Sakuro writes: > grep(pat) > and grep(pat) block > > should be considered to be shortcuts for > > select{|item| pat==item } > and select{|item| if pat==item then block(item); true; else false; end } > > respectively. I found typo: select{|item| pat===item } and select{|item| if pat===item then block(item); true; else false; end } E.g., p [1,30,100,57].grep(10..90) #=> [30, 57] p [1, "a", :foo, []].grep(String) #=> ["a"] -- Gotoken