replacing a ratio

hi, I have an expression that contains a lot of parameters. among these parameters, a have (a/b) and i would like to replace it with one term (w).
is there a command in mathematica that i can use it to replace it?
thanks.

In[1]:= (3 + a/b) /. a → b*w

Out[1]= 3 + w

If you have

In[275]:= (a + (a/b)^2) /. a -> b*w

Out[275]= b w + w^2

But if you add another /. b*w → a

In[267]:= (a + (a/b)^2) /. a -> b*w /. b*w -> a

Out[267]= a + w^2

Eric

That’s because it can’t match b*w to w^2 but:

In[1]:= (a + (a/b)^2) /. a -> b*w /. w -> a/b

Out[1]= a + a^2/b^2