---
title: "Verbatim"
language: "en"
type: "Symbol"
summary: "Verbatim[expr] represents expr in pattern matching, requiring that expr be matched exactly as it appears, with no substitutions for blanks or other transformations."
keywords: 
- disabling patterns
- literal patterns
- transforming rules
- transforming patterns
- pattern language
canonical_url: "https://reference.wolfram.com/language/ref/Verbatim.html"
source: "Wolfram Language Documentation"
related_guides: 
  - 
    title: "Patterns"
    link: "https://reference.wolfram.com/language/guide/Patterns.en.md"
  - 
    title: "Text Content Types"
    link: "https://reference.wolfram.com/language/guide/TextContentTypes.en.md"
related_functions: 
  - 
    title: "HoldPattern"
    link: "https://reference.wolfram.com/language/ref/HoldPattern.en.md"
related_tutorials: 
  - 
    title: "Patterns and Transformation Rules"
    link: "https://reference.wolfram.com/language/tutorial/PatternsAndTransformationRules.en.md"
  - 
    title: "Verbatim Patterns"
    link: "https://reference.wolfram.com/language/tutorial/Patterns.en.md#64470009"
---
# 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.

## Details

* ``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.

---

## Examples (3)

### Basic Examples (2)

Match any expression:

```wl
In[1]:= MatchQ[any[expression], x_]

Out[1]= True
```

Match only the pattern ``x_`` :

```wl
In[2]:= MatchQ[any[expression], Verbatim[x_]]

Out[2]= False

In[3]:= MatchQ[x_, Verbatim[x_]]

Out[3]= True
```

---

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

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

Out[1]= {f[x], x^2, f[y_], f[x_, y_]}
```

### Scope (1)

Transform a rule into a list of rules with special cases:

```wl
In[1]:= rule = x_ :> x ^ 2;
```

This rule transforms an expression into its square:

```wl
In[2]:= 2 + f[1 + b] + g[3., 4 + 5 I] /. rule

Out[2]= (2 + f[1 + b] + g[3., 4 + 5 I])^2
```

Use ``Verbatim`` to make rules specific for number types:

```wl
In[3]:= specifics = Table[rule /. Verbatim[x_] :> Pattern[x, Blank[type]], {type, {Integer, Real, Rational}}]

Out[3]= {x_Integer :> x^2, x_Real :> x^2, x_Rational :> x^2}
```

The list of specific rules only transforms integers, reals, and rationals:

```wl
In[4]:= 2 + f[1 + b] + g[3., 4 + 5 I] /. specifics

Out[4]= 4 + f[1 + b] + g[9., 4 + 5 I]
```

## See Also

* [`HoldPattern`](https://reference.wolfram.com/language/ref/HoldPattern.en.md)

## Tech Notes

* [Patterns and Transformation Rules](https://reference.wolfram.com/language/tutorial/PatternsAndTransformationRules.en.md)
* [Verbatim Patterns](https://reference.wolfram.com/language/tutorial/Patterns.en.md#64470009)

## Related Guides

* [`Patterns`](https://reference.wolfram.com/language/guide/Patterns.en.md)
* [Text Content Types](https://reference.wolfram.com/language/guide/TextContentTypes.en.md)

## History

* Introduced in 1996 (3.0)