This is documentation for Mathematica 4, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)
Wolfram Research, Inc.

Repeated PatternsPatterns for Some Common Types of Expression

2.3.12 Verbatim Patterns

Verbatim patterns.

Here the x_ in the rule matches any expression.

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

Out[1]=

The Verbatim tells Mathematica that only the exact expression x_ should be matched.

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

Out[2]=

Repeated PatternsPatterns for Some Common Types of Expression