vim supports regex searching and substituting http://vimregex.com/:
That is the desired regex:
AA((?!B{2})|(?!C{2}))
The above regex can be validate here.
In vim:
/^\(AA\)\(BB\)\@!.*$
will find all the AA..
format strings and will skip AABB
strings.
in order to skip
AACC
andAABB
you can use:/^\(AA\)\(\(BB\)\|\(CC\)\)\@!.*$
or equivalently:
/^\(AA\)\(\(B\{2\}\)\|\(C\{2\}\)\)\@!.*$
eliminate the
^
from the strings if you want to find strings likeAAXC
inside string of the formBAAXC
.