The thing to remember is that the lookahead can see farther than the end of the lookbehind, so you need to explicitly limit it. You could use that feature to get a slightly different solution to the first problem:

/.. # match first two chars
(?:
(?<= # looking behind,
(?!(.)\1\1) # don't allow a run of three
..) # starting only two chars back
. # then match the next char
){1,4}/x