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

Verbatim

Verbatim[expr]
represents expr in pattern matching, requiring that expr be matched exactly as it appears, with no substitutions for blanks or other transformations.
  • Verbatim[x_] will match only the actual expression x_.
  • Verbatim is useful in setting up rules for transforming other transformation rules.
  • Verbatim[expr] does not maintain expr in an unevaluated form.
Match any expression:
Match only the pattern x_:
Changes the pattern only when it is explicitly:
Match any expression:
In[1]:=
Click for copyable input
Out[1]=
Match only the pattern x_:
In[2]:=
Click for copyable input
Out[2]=
In[3]:=
Click for copyable input
Out[3]=
 
Changes the pattern only when it is explicitly:
In[1]:=
Click for copyable input
Out[1]=
Transform a rule into a list of rules with special cases:
This rule transforms an expression into its square:
Use Verbatim to make rules specific for number types:
The list of specific rules only transforms integers, reals, and rationals:
New in 3