Mathematica 9 is now available
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.
Mathematica > Core Language > Rules & Patterns > Patterns > Verbatim >

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
Ask a question about this page  |  Suggest an improvement  |  Leave a message for the team
Format:   HTML  |  CDF