in reply to Probably silly regex question / not so silly regex question

/^(.*?)\.(\w+)$/;
maybe?



lindex
/****************************/ jason@gost.net, wh@ckz.org http://jason.gost.net /*****************************/

Replies are listed 'Best First'.
Re: Re: Probably silly regex question / not so silly regex question
by Anonymous Monk on Nov 09, 2001 at 12:28 UTC
    As for the first question (posted over a year ago... whew), this is a pretty easy way to do it: $file = $filename; $ext = $filename; $file =~ s/.+\\(^\\+)$|.+\/(^\/+)$/$1/; $ext =~ s/\.(\w+)$/$1/; That should give you the file's name in $file and it's extension in, well, $ext. ;) - Dave Baughman