Given an input like @1=A1@2=A2@3=A3>>@1=B1@2=B2@3=B3>>@1=C1@2=C2@3=C3>>@1=D1@2=D2@3=D3, I want to match @2=A2 and @2=B2 such that there is only one >> between them.
I tried the regex (?!@2=A2.*>>.*>>.*@2=B2)@2=A2@.*>>.*@2=B2.
This correctly identifies input like
@1=A1@2=A2@3=A3>>@1=B1@2=B2@3=B3>>@1=C1@2=C2@3=C3>>@1=D1@2=D2@3=D3 and also ignores the input
@1=A1@2=A2@3=A3>>@1=C1@2=C2@3=C3>>@1=B1@2=B2@3=B3>>@1=D1@2=D2@3=D3(@2=B2 comes after @2=A2 but @2=C2 is in between.).
However, it fails on inputs like @1=A1@2=A2@3=A3>>@1=B1@2=B2@3=B3>>@1=B1@2=B2@3=B3>>@1=D1@2=D2@3=D3.