From: Brian Candler Date: 2008-11-21T05:15:08+09:00 Subject: Re: Array.include? with a regex? Sergio Ruiz wrote: > i am wondering if this is possible.. i can't seem to figure it out.. > > i am trying to see if a value is inside an array using regex.. > > something like: > > a = ["pie","cookies","soda","icecream"] > > i want to see if something starts with "coo" i should get one.. irb(main):001:0> a = ["pie","cookies","soda","icecream"] => ["pie", "cookies", "soda", "icecream"] irb(main):002:0> a.find { |e| /^coo/ =~ e } => "cookies" -- Posted via http://www.ruby-forum.com/.