---
title: "wholeMatch(of:)"
framework: swift
role: symbol
role_heading: Instance Method
path: "swift/bidirectionalcollection/wholematch(of:)-7741n"
---

# wholeMatch(of:)

Returns a match if this string is matched by the given regex in its entirety.

## Declaration

```swift
func wholeMatch<R>(of regex: R) -> Regex<R.RegexOutput>.Match? where R : RegexComponent
```

## Parameters

- `regex`: The regular expression to match.

## Return Value

Return Value The match, if one is found. If there is no match, or a transformation in regex throws an error, this method returns nil.
