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

# matches(of:)

Returns a collection containing all non-overlapping matches of the regex, created by the given closure.

## Declaration

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

## Parameters

- `content`: A closure that returns the regex to search for.

## Return Value

Return Value A collection of matches for the regex returned by content. If no matches are found, the returned collection is empty.
