Thanks Bernd! I tried your approach with my real example, sometimes it worked, 
sometimes it didn't. For example

grep('[^(arg)]\\.symptom',"stomach.symptom",value=T)
[1] "stomach.symptom"

grep('[^(arg)]\\.symptom',"liver.symptom",value=T)
character(0)

I think both examples should return the text, but the 2nd example didn't.

What was wrong here?

Thanks

John




________________________________
From: Bernd Weiss <bernd.we...@uni-koeln.de>

Sent: Thu, March 31, 2011 5:32:25 PM
Subject: Re: [R] regular expression

Am 31.03.2011 19:31, schrieb array chip:
> Hi, I am stuck on this: how to specify a match pattern that means not
> to include "abc"?
>
> I tried:
>
> grep("^(abc)", "hello", value=T) should return "hello".

> grep("[^(abc)]", "hello", value=T)
[1] "hello"


HTH,

Bernd

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to