6.94 How to replace subexpression with condition?

Given

\[ a \sqrt {z}+\sin \left (c \sqrt {r+4}+20\right )+\frac {e^{-c} \sqrt {9 e^{2 c} x^2+8}-x+99}{4 x}+4 \sqrt {h} e^y-99 \]

Replace only the subexpression of the form  anything*Exp[anyting]*Sqrt[anything] by the square of the pattern found if any.

expr /. patternName : (Exp[any3_]*any_.)*Power[Any_, Rational[1 | -1, 2]] -> patternName^2
 

This gives

\[ a \sqrt {z}+\sin \left (c \sqrt {r+4}+20\right )+\frac {e^{-2 c} \left (9 e^{2 c} x^2+8\right )-x+99}{4 x}+16 h e^{2 y}-99 \]

The code  patternName : above gives a name for the pattern found, this way we can use the name to easily do any transformation needed. In this example, it was just squaring it. But it can be anything else we want.