From: David Alan Black Date: 2002-08-06T00:10:43+09:00 Subject: Re: Regex question On Tue, 6 Aug 2002, David Alan Black wrote: > Hi -- > > On Mon, 5 Aug 2002, Mike Hall wrote: > > > David Alan Black wrote: > > > > > /[^.]*$/.match(file)[0] > > > > Now wouldn't all this be much simpler if we had a method > > along the lines of 'basename', which would pull off the > > extension (or suffix) for us? We already have File::basename > > and File::dirname, so why not a File::last-part-of-the-name-name? > > > > Or what about a 'File::parts' which returns an array of: > > directory (or nil), root name (or nil), suffix(es) (or nil). > > Would that be more Ruby-esqe? > > Heavens -- object-oriented regular expressions are Ruby-esque enough > for you? :-) sub(/are/, "aren't") # :-) David -- David Alan Black home: dblack@candle.superlink.net work: blackdav@shu.edu Web: http://pirate.shu.edu/~blackdav