Re: [R] Regex engine types

From: Gabor Grothendieck <ggrothendieck_at_gmail.com>
Date: Sat 10 Jun 2006 - 15:40:24 EST

I get the same thing on "Version 2.3.1 Patched (2006-06-04 r38279)" but on "R version 2.2.1, 2005-12-20" it gives character(0), as expected, so there is some change between versions of R. I am on Windows XP.

On 6/9/06, Patrick Connolly <p_connolly@ihug.co.nz> wrote:
> > version
> _
> platform x86_64-unknown-linux-gnu
> arch x86_64
> os linux-gnu
> system x86_64, linux-gnu
> status
> major 2
> minor 2.1
> year 2005
> month 12
> day 20
> svn rev 36812
> language R
> >
>
> > grep("[W-Z]", LETTERS, value = TRUE)
> [1] "W" "X" "Y" "Z"

>
> That's what I'd have expected.

>
> > grep("[W-Z]", letters, value = TRUE)
> [1] "x" "y" "z"

>
> Not what I'd have thought. However,

>
> > grep("[B-D]", letters, value = TRUE, perl = TRUE)
> character(0)
>
> So what is it that standard regular expressions use that's different
> from Perl-type ones?

>
> The help file for grep refers to POSIX 1003.2 which looked a bit
> daunting to delve into. From my limited reading, it seems there are
> different gegex "Engine Types" which seems to be getting somewhat
> tangential to what I was working on. I could probably avoid problems
> if I always set perl=TRUE, but it would be good to know what basic and
> extended regular expressions do that's different. If someone has a
> quick line or two describing it, I'd be interested to know.

>
> Thanks
>
> --
> ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.
> ___ Patrick Connolly
> {~._.~} Great minds discuss ideas
> _( Y )_ Middle minds discuss events
> (:_~*~_:) Small minds discuss people
> (_)-(_) ..... Anon
>
> ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Sat Jun 10 15:44:08 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Sun 11 Jun 2006 - 05:34:59 EST.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.