[R-pkg-devel] [External] [External] RcmdrPlugin.HH_1.1-48.tar.gz

Serguei Sokol @ergue|@@oko| @end|ng |rom gm@||@com
Thu Mar 7 14:38:26 CET 2024


Le 07/03/2024 à 11:08, Duncan Murdoch a écrit :
> On 07/03/2024 4:16 a.m., Ivan Krylov wrote:
>> On Wed, 6 Mar 2024 13:46:55 -0500
>> Duncan Murdoch <murdoch.duncan using gmail.com> wrote:
>>
>>> is this just a more or less harmless error, thinking that
>>> the dot needs escaping
>>
>> I think it's this one. You are absolutely right that the dot doesn't
>> need escaping in either TRE (which is what's used inside exportPattern)
>> or PCRE. In PRCE, this regular expression would have worked as intended:
>>
>> # We do match backslashes by mistake.
>> grepl('[\\.]', '\\')
>> # [1] TRUE
>>
>> # In PCRE, this wouldn't have been a mistake.
>> grepl('[\\.]', c('\\', '.'), perl = TRUE)
>> # [1] FALSE TRUE
>>
> 
> Thanks, I didn't realize that escaping in PCRE was optional.
Escaping is optional only in brackets []. Without them it becomes 
mandatory if we want to catch just "." not any character :

grepl('.', c('\\', '.'), perl = TRUE)
#[1] TRUE TRUE

Best,
Serguei.


> 
> So the default exportPattern line could be
> 
>    exportPattern("^[^.]")
> 
> and it would work even if things were changed so that PCRE was used 
> instead of TRE.
> 
> Duncan Murdoch
> 
> ______________________________________________
> R-package-devel using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel



More information about the R-package-devel mailing list