# Why can't I get the argument for my base function from the transformed function?

Consider the following transformed function as an example:

FirstCase[Hold[Sqrt[-3(x+1)]-4],Sqrt[x_]:>x,x,∞]
FirstCase[HoldForm[Sqrt[-3(x+1)]-4],Sqrt[x_]:>x,x,∞]
FirstCase[HoldComplete[Sqrt[-3(x+1)]-4],Sqrt[x_]:>x,x,∞]
FirstCase[Unevaluated[Sqrt[-3(x+1)]-4],Sqrt[x_]:>x,x,∞]
FirstCase[Defer[Sqrt[-3(x+1)]-4],Sqrt[x_]:>x,x,∞]


None of them are able to grab the correct argument of Sqrt[...] which is -3(x+1).

The problem is that Sqrt[x_] gets nontrivially evaluated on the lhs of that rule—check Sqrt[x_] // FullForm. (Like :=, :> only prevents evaluation of its rhs, not its lhs.)
FirstCase[Hold[Sqrt[-3 (x + 1)] - 4], HoldPattern[Sqrt[x_]] :> x, x, Infinity]

• Thank you I didn't notice it as evaluating Sqrt[x_] still produced the nice typeset of Sqrt. Jun 15 at 2:18