Message-ID: <49337430.6050608@idi.ntnu.no>
Date: 2008-12-01T05:20:48Z
From: Wacek Kusnierczyk
Subject: Regex: workaround for variable length negative lookbehind
In-Reply-To: <971536df0811301226l5ede3e3m4187c96c04c96886@mail.gmail.com>
Gabor Grothendieck wrote:
> Try this:
>
>
>> vec <- c("aaaa", "baaa", "bbaa", "bbba", "baamm", "aa")
>>
>
>
>> grep("^(?!(.)\\1{1,}$).*(.)\\2{1,}$", vec, perl = TRUE)
>>
or even
grep("^(?!(.)\\1+$).*(.)\\2+$", vec, perl = TRUE)
vQ