From: Joshua Ball Date: 2008-12-18T13:45:24+09:00 Subject: Re: Array problem ------=_Part_31874_16980895.1229575995937 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Actually, the regex should have the end of string anchor: array.delete_if { |elem| not elem =~ /.bmp$/i } On Wed, Dec 17, 2008 at 8:40 PM, Joshua Ball wrote: > I think this should do it: > > array.delete_if { |elem| not elem =~ /.bmp/i } > It worked for the following test: > array = [ "manyThings.mp3", "myLike.gif", "moreCoco.BmP", "theFormat.bmp"] > array.delete_if { |elem| not elem =~ /.bmp/i } > array.each do |elem| > puts elem > end > > > On Wed, Dec 17, 2008 at 8:22 PM, John Zoldiark >wrote: > > > I have an array like this: > > array = [ "manyThings.mp3", "myLike.gif", "moreCoco.bmp", > > "theFormat.bmp"] > > > > and I want to make some comparison to eliminate all the words in the > > array that are NOT of the bmp format. So at the end the array will look > > like this: > > > > array = ["moreCoco.bmp", "theFormat.bmp"] > > > > is there a way to do this??? > > > > Many thanks for the help > > -- > > Posted via http://www.ruby-forum.com/. > > > > > ------=_Part_31874_16980895.1229575995937--