From: Matt White Date: 2007-09-06T06:00:56+09:00 Subject: Re: simple get file by filename --0-659024408-1189026049=:99816 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable A regular expression will do just fine.=0A=0Aentries.each do |entry|=0A pu= ts entry if entry =3D~ /^jpg_image/=0Aend=0A=0A----- Original Message ----= =0AFrom: eggie5 =0ATo: ruby-talk ML =0ASent: Wednesday, September 5, 2007 2:55:07 PM=0ASubject: simple get = file by filename=0A=0AConsider this:=0A=0AI have a list of files that I get= by calling:=0A=0A Dir.entries("/")=0A=0AI just want to search this list an= d match the file name that matches=0A1_1.* ( i.e. the filename without the = extension)=0A=0ASo, for example, If the pattern to match against the list w= as=0A"jpg_image." it should return the filename "jpg_image.jpg" (assuming= =0Athe file exists).=0A=0AWhat's the most succinct way to do this in ruby?= =0A=0A=0A=0A=0A=0A=0A=0A=0A=0A =0A___________________________________= _________________________________________________=0ASick sense of humor? Vi= sit Yahoo! TV's =0AComedy with an Edge to see what's on, when. =0Ahttp://tv= .yahoo.com/collections/222 --0-659024408-1189026049=:99816--