Earlier quoted context omitted.
You need to pin the match to the start and end of the string with ^ and $ respectively otherwise the negation just matches an empty string or other irrelevant string.
Just to follow my thought pattern. I start with (.)(.)\2\1 Now to invert I change it to (?!(.)(.)\3\2) As you say, the negation matches an empty string. So I put on anchors: ^(?!(.)(.)\3\2)$ But now it matches nothing. I'm not even sure what that regexp says. The entire string is a negation? Would anything match that regexp? I see elsewhere on this page that the answer involves putting in an extra dummy character, pu…
^(?!.*(.)(.)\2\1)
You may also need to fill in the places where it could be anything. The above worked on abba for me.BTW a double space indent then formats as code on HN I think.