On Friday 20 September 2002 11:55 am, dblack / candle.superlink.net wrote:
>
> I would use #select, which filters based on a condition contained
> in a code block:
>
>   a = ["aaa","abb","bbb","acc","bcc","ccc"]
>   puts a.select {|e| /(a|c)cc/.match(e)}
>
>   =>
>     acc
>     ccc
>
>
> David

I think I'd use Enumerable#grep in this case:

irb(main):001:0> a = ["aaa","abb","bbb","acc","bcc","ccc"]
  ["aaa", "abb", "bbb", "acc", "bcc", "ccc"]
irb(main):002:0> a.grep /(a|c)cc/
  ["acc", "ccc"]


~ Bruce

-- 
_/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ 
  Bruce Williams               http://www.codedbliss.com
  iusris/#ruby-lang            bruce / codedbliss.com
_/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/