This question came up in https://mathematica.stackexchange.com/questions/274535/replacing-only-variables-in-specific-locations-with-replace-all
where the user wanted to I would like to replace R0 with r, but only in the arguments of functions.
The input they had is line = R0*f[R0,x] + R0^2*42*D[g[R0,x],x]
In Maple, this can be done as follows, which I think is a easier thanks to Maple’s strong type system.
line := R0*f(R0,x) + R0^2*42*diff(g(R0,x),x); evalindets(line, 'patfunc(identical(R0),anything)', Z-> subsop(1 = r, Z ));
Which gives