---
title: "matches(of:)"
framework: swift
role: symbol
role_heading: Instance Method
path: "swift/bidirectionalcollection/matches(of:)-5hhx"
---

# matches(of:)

Returns a collection containing all matches of the specified regex.

## Declaration

```swift
func matches<Output>(of r: some RegexComponent) -> [Regex<Output>.Match]
```

## Return Value

Return Value A collection of matches of regex.
