---
title: "init(verbatim:)"
framework: swift
role: symbol
role_heading: Initializer
path: "swift/regex/init(verbatim:)"
---

# init(verbatim:)

Creates a regular expression that matches the given string exactly, as though every metacharacter in it was escaped.

## Declaration

```swift
init(verbatim verbatimString: String)
```

## Parameters

- `verbatimString`: A string to convert into a regular expression exactly, escaping any metacharacters.

## Discussion

Discussion This example creates a regular expression that matches the string "(adj)", including the parentheses. Although parentheses are regular expression metacharacters, they do not need escaping in the string passed as verbatimString. let adjectiveDesignator = Regex<Substring>(verbatim: "(adj.)")

print("awesome (adj.)".contains(adjectiveDesignator)) // Prints "true" print("apple (n.)".contains(adjectiveDesignator)) // Prints "false"
