@Grimy I think you had the same problem as me. It can be fixed with ^((x*)(\2x)*)(?=xx\1$)((?=\2+(x*))\5(?=(\5xx)*$)(?=((x*)(?=\6(\8*$))x)\7*$)\9(?=\2\3*\6$))*\2\2$|^xx?$ (which can likely be golfed)
Here's another of the same length (unfortunately has \10 and is much slower): ^(((x*)(\3x)*)(?=((?=\3+(x*))\6(?=(\6xx)*$)(?=((x*)(?=\7(\9*$))x)\8*$)\10(?=\4+\6x$))*\3\3$)x\2|x?)x$