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.

DetailsDetails

  • 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.

ExamplesExamplesopen allclose all

Basic Examples (2)Basic Examples (2)

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]=
New in 3
New to Mathematica? Find your learning path »
Have a question? Ask support »