On Thu, Jan 12, 2012 at 4:22 PM, K Clair [email protected]
wrote:
biglist !~ /bar/
!biglist.grep(/bar/)
This was a joke, wasn’t it?
irb(main):001:0> a=19.times.map &:to_s
=> [“0”, “1”, “2”, “3”, “4”, “5”, “6”, “7”, “8”, “9”, “10”, “11”,
“12”, “13”, “14”, “15”, “16”, “17”, “18”]
irb(main):002:0> a !~ /0/
=> true
irb(main):003:0> !a.grep /0/
=> false
I’d use #select with inverted condition or #reject
irb(main):005:0> a.select {|s| /0/ !~ s}
=> [“1”, “2”, “3”, “4”, “5”, “6”, “7”, “8”, “9”, “11”, “12”, “13”,
“14”, “15”, “16”, “17”, “18”]
irb(main):006:0> a.reject {|s| /0/ =~ s}
=> [“1”, “2”, “3”, “4”, “5”, “6”, “7”, “8”, “9”, “11”, “12”, “13”,
“14”, “15”, “16”, “17”, “18”]
Cheers
robert