in reply to Re: Re: Re: Parse out the extension of a filename - return base of filename.
in thread Parse out the extension of a filename - return base of filename.

To a certain degree I can second that. Using rindex and index can cause issues. Consider if you have directories with dots in em? Consider if you have multiple extensions, eg File.pl.bak. And for using rindex and index for other aspects of path parsing is also bad especially when you consider the the various path delimiters, and portability issues.

Actually it was the use of rindex that caused a script here to behave very strangely just the other day.

BTW, you and snafu might like to have a look at one of my earlier posts (and the thread its in) for some interesting discussion about parsing filenames/urls with a regex.

Yves / DeMerphq
---
Writing a good benchmark isnt as easy as it might look.

  • Comment on Re: Re: Re: Re: Parse out the extension of a filename - return base of filename.