Try this instead expr := Hold[Cos[\[Omega] t - \[Pi]/4 + 3 \[Pi]/4]] rule := Cos[a_ + b_] :> X[a, b] ReleaseHold[ReplaceAll[expr, {rule}]] > X[t \[Omega], \[Pi]/2]