[OT] REGEX Help

Paul Howarth paul at city-fan.org
Fri Mar 18 16:16:26 UTC 2005


Yang Xiao wrote:
> Hi all,
> I can't remember how to strip the full path out and just get the file
> name in something like this
> /fullpath/to/file or /full/path/to/file.ext
> Can anyone provide a regex that will get me just file or file.ext.

You don't say what language you are trying to do this in.

If it's part of a shell script you can just use:

filename=`basename $pathname`

Paul.




More information about the fedora-list mailing list