Question: How to replace many variables with one

How can I replace/substitute a combination of variables with a new variable?

For example, if ...

h:=(1+i)^2+(1+i)^3*A+(1+i)^4*B

I want to assign the value g:=1+i

so that h returns g^2+g^3*A+g^4*B

Do I have to change the 1+i to a name? or can it be done as it is?

Please Wait...