[R] regular expression

Peter Langfelder peter.langfelder at gmail.com
Fri Apr 1 02:55:26 CEST 2011


On Thu, Mar 31, 2011 at 5:49 PM, array chip <arrayprofile at yahoo.com> wrote:
> 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?

Operator error :) Since you exclude 'r' before the '.', liver.symptom
does not match the pattern.

Peter



More information about the R-help mailing list