search for: baamm

Displaying 1 result from an estimated 1 matches for "baamm".

Did you mean: bamm
2008 Nov 30
6
Regex: workaround for variable length negative lookbehind
...the following regular expression problem: I want to find complete elements of a vector that end in a repeated character but where the repetition doesn't make up the whole word. That is, for the vector vec: vec<-c("aaaa", "baaa", "bbaa", "bbba", "baamm", "aa") I would like to get "baaa" "bbaa" "baamm" >From tools where negative lookbehind can involve variable lengths, one would think this would work: grep("(?<!(?:\\1|^))(.)\\1{1,}$", vec, perl=T) But then R doesn't like it that...