Is it possible to specify a context-sensitive, “depth-agnostic” rewrite rule? ++Thanks! This goes a long way. Minor follow-up comment/question: for RR1-RR3, it looks to me like, for the innermost replacement, Rule may be used instead of RuleDelayed... I haven't yet come up with a case that would distinguish a clear preference for one (of Rule vs RuleDelayed) over the other.