[R] regular expression
bernd.weiss at uni-koeln.de
Fri Apr 1 03:19:25 CEST 2011
Am 31.03.2011 21:06, schrieb array chip:
> Ok then this code didn't do what I wanted. I want "not including
> 'arg' before '.symptom'", not individual letters of "arg", but rather
> as a word.
> Bill Dunlap suggested using invert=T, it works for single 1
> condition, but not for 2 conditions here: not including "arg" before
> ".", but at the same time, does include ".symptom".
> Any other suggestions would be appreciated
This does work (but I am by no means an expert in regex...). I am using
'negative lookbehind' to define an expression like 'arg'.
> grep('(?<!(arg))\\.symptom',"arg.symptom",value=T, perl = T)
> grep('(?<!(arg))\\.symptom',"liver.symptom",value=T, perl = T)
More information about the R-help