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.


open allclose all

Basic Examples  (2)

Match any expression:

Match only the pattern x_:

Changes the pattern only when it is explicitly f[x_]:

Scope  (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:

Introduced in 1996