From Kurt.Hornik at wu.ac.at  Tue Nov 10 21:03:52 2009
From: Kurt.Hornik at wu.ac.at (Kurt Hornik)
Date: Tue, 10 Nov 2009 21:03:52 +0100
Subject: [Rd] Alphanumeric tools::file_path_sans_ext() (PR#14050)
In-Reply-To: <20091109153510.B9F7F282EF57@mail.pubhealth.ku.dk>
References: <20091109153510.B9F7F282EF57@mail.pubhealth.ku.dk>
Message-ID: <19193.50984.56587.125821@fangorn.hornik.net>

>>>>> arnima  writes:

> The file_path_sans_ext() function in the 'tools' package does not handle 
> alphanumeric file extensions correctly:

>    require(tools)
>    file_path_sans_ext("song.txt")  # song, correct
>    file_path_sans_ext("song.mp3")  # song.mp3, wrong

> The help page states that "only purely alphanumeric extensions are 
> recognized", which I had expected. To fulfill this, the function body 
> should be

>    sub("([^.]+)\\.[[:alnum:]]+$", "\\1", x)

> instead of the current definition:

>    sub("([^.]+)\\.[[:alpha:]]+$", "\\1", x)

> Thanks,

> Arni

Thanks, fixed now.

Best
-k

> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



[Rd] Alphanumeric tools::file_path_sans_ext() (PR#14050)
Kurt Hornik