--Apple-Mail-24--207394444
Content-Type: text/plain;
	charset-ASCII;
	format­´wed
Content-Transfer-Encoding: 7bit


On 2008.11.20., at 19:57, 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..
>
> it doesn't look like i am doing it correctly..
>
>
> irb(main):010:0> a.include?(/^coo/)
> false
>
> ideas?

Enumerable#grep:

a  "pie","cookies","soda","icecream"]
a.grep /^coo/

Cheers,
Peter
___
http://www.rubyrailways.com
http://scrubyt.org


--Apple-Mail-24--207394444--