From: Michael Fellinger Date: 2009-02-24T15:02:21+09:00 Subject: Re: what is best idiom to remove file extension On Tue, Feb 24, 2009 at 9:09 AM, bwv549 wrote: > All great answers - much better than what I was doing before. > > To summarize then... > > full pathname with no extension: >    File.expand_path(File.basename(fname, File.extname(fname)) > > easy to remember and read: >    fname.chomp(File.extname(fname) ) > > shortest: >    fname[/.*(?=\..+$)/] You can also use: File.basename('foo.bar', '.*') # "foo" ^ manveru