Skip to content

Regex: workaround for variable length negative lookbehind

3 messages · Gabor Grothendieck, Wacek Kusnierczyk

#
Gabor Grothendieck wrote:
or even

grep("^(?!(.)\\1+$).*(.)\\2+$", vec, perl = TRUE)


vQ
#
On Mon, Dec 1, 2008 at 12:20 AM, Wacek Kusnierczyk
<Waclaw.Marcin.Kusnierczyk at idi.ntnu.no> wrote:
Or combining the previous simplification I posted with yours:
[1] 2 3 5
#
Gabor Grothendieck wrote:
ha!  you can even make it a tiny little bit faster:

grep("^(?!(.)\\1+$).+(.)\\2$", vec, perl = TRUE)

;)

vQ