I have a Mathematica expression that contains a single square root, schematically
expr = a / (b + Sqrt[c]);
where a,b
a
b
Theoretically, this should work correctly:
extractSqrt = Cases[ToBoxes@#, SqrtBox@x_ :> ToExpression@x, Infinity] &; extractSqrt[expr]