Verbatim Patterns

Verbatim patterns.

Here the x_ in the rule matches any expression:

{f[2],f[a],f[x_],f[y_]}/.f[x_]->x^2

The (RefLink[Verbatim, paclet:ref/Verbatim]) tells the Wolfram Language that only the exact expression x_ should be matched:

{f[2],f[a],f[x_],f[y_]}/.f[Verbatim[x_]]->x^2