Re: [R] negation in grep

2009-06-22 Thread Gabor Grothendieck
Try txt[- grepl(pattern, txt)] txt[! grepl(pattern, txt)] On Mon, Jun 22, 2009 at 5:45 PM, orzack wrote: > Does anybody know how to negate a string in a grep command, i.e., what I > need is to return only strings that do NOT contain a second string anywhere > in the entire string. > > > for

Re: [R] negation in grep

2009-06-22 Thread Henrique Dallazuanna
You can try somthing about like this: setdiff(txt, grep("(oob|boo|\\w[^oo]\\w)", txt, value = TRUE)) On Mon, Jun 22, 2009 at 6:45 PM, orzack wrote: > Does anybody know how to negate a string in a grep command, i.e., what I > need is to return only strings that do NOT contain a second string an

[R] negation in grep

2009-06-22 Thread orzack
Does anybody know how to negate a string in a grep command, i.e., what I need is to return only strings that do NOT contain a second string anywhere in the entire string. for txt <- c("boo","goo","doob","foo","boofoo") I need a grep command that returns strings with "oo" except when "b" is