Let's consider the following example
Rd0 = Sqrt[R^2 + (a + Sqrt[h^2 + z^2])^2];
Rn0 = Sqrt[R^2 + z^2] - rs;
Vd = -Md/Rd0;
Vn = -Mn/Rn0;
Veff = Vd + Vn + Lz^2/(2*R^2);
VR = D[Veff, R];
The expression VR
gives
-(Lz^2/R^3)+(Mn R)/(Sqrt[R^2+z^2] (-rs+Sqrt[R^2+z^2])^2)+(Md R)/
(R^2+(a+Sqrt[h^2+z^2])^2)^(3/2)
Now I want to replace some expressions, using the rule
rule = {Sqrt[h^2 + z^2] -> Rdz; Sqrt[R^2 + z^2] -> Rcn;
(R^2 + (a + Sqrt[h^2 + z^2])^2)^(3/2) -> Rd^3};
However, when I apply it as VR /. rule1
I get
-(Lz^2/R^3)+(Mn R)/((Rcn-rs)^2 Sqrt[R^2+z^2])+(Md R)/
(R^2+(a+Sqrt[h^2+z^2])^2)^(3/2)
As we see, only one of the terms has been replaced, while all the others have not been replaced. So my question is: how can I efficiently replay all the expressions according to the above rule?