I'm looking for a regex that finds all words in a list that do not have characters next to each other that are the same. (this is an exercise)
So abcdef is printed, but aabcdef is not.
I tried both
egrep "^((.)[^\1])*$"
and egrep "^((.)[^\2])*$" words but, other than being not sure which one would be right, they don't work.
I know I can go egrep -v "(.)\1", but i want to use the regex in an OR structure with some other ones, so that's not possible.
For those interested, the full exercise is to find all words that have exactly two character pairs, so aacbb and aabbd are matched, but abcd and aabbcc are not.
Thanks,