Message-ID: <9b4cc5750905131641p113617b4o44a82b356aa8e9e2@mail.gmail.com>
Date: 2009-05-13T23:41:46Z
From: Stephen J. Barr
Subject: matching period with perl regular expression
Hello,
I have several strings where I am trying to eliminate the period and
everything after the period, using a regular expression. However, I am
having trouble getting this to work.
> x = "wa.w"
> gsub(x, "\..*", "", perl=TRUE)
[1] ""
Warning messages:
1: '\.' is an unrecognized escape in a character string
2: unrecognized escape removed from "\..*"
In perl, you can match a single period with \.
Is this not so even with perl=TRUE. I would like for x to be equal to
> x = "wa"
What am I missing here?
-stephen
==========================================
Stephen J. Barr
University of Washington
WEB: www.econsteve.com