Yes, it does the trick:
In[104]:= A = Array[x[#1, #2] &, {3, 3}];
IA = Inverse[A];
B = Array[y[#1, #2] &, {3, 3}];
IB = Inverse[B];
{A, B, IA, A, B, IA, A, B, IA, A, B, IA, A, B,
IA} //. ({x___, y_, z_, t___} /;
Simplify[y . z == IdentityMatrix[3]]) :> {x, t};
% == {A, B, B, B, B, B, IA}
(*Timing[
{A,B,IA,A,B,IA,A,B,IA,A,B,IA,A,B,IA}//.({x___,y_,z_,t___}/;Simplify[y.\
z==IdentityMatrix[3]]):>{x,t};
%=={A,B,B,B,B,B,IA}
]*)
Out[109]= True
BTW, how to check the performance of the above code block by Timing? I tried the following, but failed:
A = Array[x[#1, #2] &, {3, 3}];
IA = Inverse[A];
B = Array[y[#1, #2] &, {3, 3}];
IB = Inverse[B];
(*{A,B,IA,A,B,IA,A,B,IA,A,B,IA,A,B,IA}//.({x___,y_,z_,t___}/;Simplify[\
y.z==IdentityMatrix[3]]):>{x,t};
%=={A,B,B,B,B,B,IA}*)
Timing[
{A, B, IA, A, B, IA, A, B, IA, A, B, IA, A, B,
IA} //. ({x___, y_, z_, t___} /;
Simplify[y . z == IdentityMatrix[3]]) :> {x, t};
% == {A, B, B, B, B, B, IA}
]
{0.006172, False}