From: MonkeeSage Date: 2007-12-27T11:24:58+09:00 Subject: Re: using reg expr with array.index On Dec 26, 4:32 pm, Esmail wrote: > If I have an array ar of strings that contains > for instance > > aaaa > bbbb > cccc > >dddd > eeee > dddd > cccc > etc. > > is there a way to use ar.index with a regular > expression to get the index of the line >dddd > > I've tried ar.index(/^>/) and (/^\>/) without > much luck. > > In other words, I'm trying to match on the first > character which is a > > > Thanks. ['aaaa', '>bbbb', 'cccc'].find { | e | e =~ /^>/ } Regards, Jordan