I have a complicate expression like this
2 a g12 (b (-1 + b c) g12^2 + b (1 - b c) g11 g22 + c g22^2) + g22 ((-1 + b^2 c^2) g12^2 + c^2 g22 (-b^2 g11 + g22)) + a^2 (g12^2 g22 + b^2 g11 (g12^2 - g11 g22))
and would like to expand it and replace
g11 a^2 + 2 g12 a c + g22 c^2 with
g11. Tried out Expand, Replace, Collect, Sort, etc. but it didn't work. Can anyone help?