[Rd] regexp with [:upper:] (PR#11032)

Prof Brian Ripley ripley at stats.ox.ac.uk
Tue Mar 25 06:43:21 CET 2008


That is correct: I suspect you meant the character class [[:upper:]]

> grep( '[[:upper:]]', letters, val=TRUE)
character(0)

You asked for matches amongst :upper:, and that is what you got.
As ?rexexp does say

      (Note that the
      brackets in these class names are part of the symbolic names, and
      must be included in addition to the brackets delimiting the
      bracket list.)

this appears to be a homework failure.

On Tue, 25 Mar 2008, mark.bravington at csiro.au wrote:

> Full_Name: Mark Bravington
> Version: 2.6.2 patched
> OS: Windows XP Pro
> Submission from: (NULL) (140.79.22.104)
>
>
>> grep( '[:upper:]', letters, val=T) # shurely shouldn't match anything ??
> [1] "e" "p" "r" "u"
>
> The converse ( '[:lower:]' and LETTERS) seems to work OK.
>
> --please do not edit the information below--
>
> Version:
> platform = i386-pc-mingw32
> arch = i386
> os = mingw32
> system = i386, mingw32
> status = Patched
> major = 2
> minor = 6.2
> year = 2008
> month = 03
> day = 21
> svn rev = 44836
> language = R
> version.string = R version 2.6.2 Patched (2008-03-21 r44836)
>
> Windows XP (build 2600) Service Pack 2
>
> Locale:
> LC_COLLATE=English_Australia.1252;LC_CTYPE=English_Australia.1252;LC_MONETARY=English_Australia.1252;LC_NUMERIC=C;LC_TIME=English_Australia.1252
>
> Search Path:
> .GlobalEnv, package:stats, package:graphics, package:grDevices, package:utils,
> package:datasets, package:methods, Autoloads, pa
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-devel mailing list