Mark.Bravington at csiro.au
2011-Sep-16 04:45 UTC
[Rd] grep problem in R-devel 2.14 r57004
Problem below with PCRE grep in R-devel; works fine in R-patched. (Unless there's been an absolutely massive change in rules for updated PCRE version 8.13; jeez I hope not)> grep( '[.][.]', '', perl=TRUE)Error in grep("[.][.]", "", perl = TRUE) : invalid regular expression '[.][.]' In addition: Warning message: In grep("[.][.]", "", perl = TRUE) : PCRE pattern compilation error 'POSIX collating elements are not supported' at '[.][.]'> sessionInfo()R Under development (unstable) (2011-09-13 r57004) Platform: i386-pc-mingw32/i386 (32-bit) locale: [1] LC_COLLATE=English_Australia.1252 LC_CTYPE=English_Australia.1252 [3] LC_MONETARY=English_Australia.1252 LC_NUMERIC=C [5] LC_TIME=English_Australia.1252 attached base packages: [1] stats graphics grDevices utils datasets methods base NB I'm sending to R-devel rather than posting a bug report because (i) I have a dim recollection that's what we're supposed to do for bugs in R-devel, and (ii) Bugzilla doesn't include an R-devel version and (iii) couldn't find any guidance on these matters. Mark -- Mark Bravington CSIRO Mathematical & Information Sciences Marine Laboratory Castray Esplanade Hobart 7001 TAS ph (+61) 3 6232 5118 fax (+61) 3 6232 5012 mob (+61) 438 315 623
Mark, quick googling gives the answer - [.] is not what you think it is, you probably meant [\.]. Bracket expressions starting with [. are collating symbols which is unsupported by PCRE (only [:xxx:] is supported, neither [=xxx=] nor [.xxx.] is) but that's probably not what you intended. See POSIX: 9.3.5 RE Bracket Expression [...] 1. [..] The character sequences "[.", "[=", and "[:" (left-bracket followed by a period, equals-sign, or colon) shall be special inside a bracket expression and are used to delimit collating symbols, equivalence class expressions, and character class expressions. Cheers, Simon On Sep 16, 2011, at 12:45 AM, <Mark.Bravington at csiro.au> <Mark.Bravington at csiro.au> wrote:> Problem below with PCRE grep in R-devel; works fine in R-patched. (Unless there's been an absolutely massive change in rules for updated PCRE version 8.13; jeez I hope not) > >> grep( '[.][.]', '', perl=TRUE) > Error in grep("[.][.]", "", perl = TRUE) : > invalid regular expression '[.][.]' > In addition: Warning message: > In grep("[.][.]", "", perl = TRUE) : PCRE pattern compilation error > 'POSIX collating elements are not supported' > at '[.][.]' > >> sessionInfo() > R Under development (unstable) (2011-09-13 r57004) > Platform: i386-pc-mingw32/i386 (32-bit) > > locale: > [1] LC_COLLATE=English_Australia.1252 LC_CTYPE=English_Australia.1252 > [3] LC_MONETARY=English_Australia.1252 LC_NUMERIC=C > [5] LC_TIME=English_Australia.1252 > > attached base packages: > [1] stats graphics grDevices utils datasets methods base > > NB I'm sending to R-devel rather than posting a bug report because (i) I have a dim recollection that's what we're supposed to do for bugs in R-devel, and (ii) Bugzilla doesn't include an R-devel version and (iii) couldn't find any guidance on these matters. > > Mark > > -- > Mark Bravington > CSIRO Mathematical & Information Sciences > Marine Laboratory > Castray Esplanade > Hobart 7001 > TAS > > ph (+61) 3 6232 5118 > fax (+61) 3 6232 5012 > mob (+61) 438 315 623 > > ______________________________________________ > R-devel at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel > >