But is there a one-line grep thingy to do this?
Can't think of a one-liner, but a three-line solution you can easily
enough wrap in a small function:
vec<-c("aaaa", "baaa", "bbaa", "bbba", "baamm", "aa")
idx.1 <- grep("(.)\\1$", vec)
idx.2 <- grep("^(.)\\1*$", vec)
vec[setdiff(idx.1, idx.2)]
Oops, my bad, that solution was in Stefan's original mail already. I
got his example mixed up with some other text and thought he was
talking about something different.
Still, I think it's better to write a few lines of R code than to
abuse regular expressions to do something they were never intended to
do. How do other people on this list feel about that issue?
Sorry again, and next time I'll trink a cup of coffee _before_ I post!
Stefan
______________________________________________
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.