From: Sebastian Hungerecker Date: 2008-12-18T18:35:39+09:00 Subject: Re: Array problem 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"] Instead of a reject/select you can also use grep when working with regexen: array.grep(/\.bmp$/) Instead of using a regex you could also use File.extname here: array.select {|x| File.extname(x)==".bmp"} Of course all these only tell you that the filenames end with .bmp, not in which format the files actually are. HTH, Sebastian -- Jabber: sepp2k@jabber.org ICQ: 205544826