Hi -- On Mon, 5 Aug 2002, Jim Freeze wrote: > On Mon, Aug 05, 2002 at 12:57:30PM +0900, Gavin Sinclair wrote: > > > On Mon, Aug 05, 2002 at 11:37:12AM +0900, David Alan Black wrote: > > >> > > >> Try this: > > >> > > >> /\.[^.]*$/ > > >> > > >> which forces the match to start at the right-most '.' on the line. > > >> > > > or this: > > > > > > /\w+$/ > > > > Hmm.. that'll do! :) Thanks. > > Note that /\w+$/ will not match all extensions. E.g., > > fred.my-dashed-ext > > will return ext. > David replied with my first (unpoosted) attempt. > To be sure you get everything past that last '.', use: > > /\.([^.]*)$/.match(file)[1] I guess Gavin didn't need to include the '.' itself in the match (it was there in the first one, but if /\w+$/ works on his example then it must not be needed). If it's not needed one could just do: /[^.]*$/.match(file)[0] David -- David Alan Black home: dblack / candle.superlink.net work: blackdav / shu.edu Web: http://pirate.shu.edu/~blackdav