---
title: "contains(_:)"
framework: swift
role: symbol
role_heading: Instance Method
path: "swift/bidirectionalcollection/contains(_:)-60wyq"
---

# contains(_:)

Returns a Boolean value indicating whether this collection contains a match for the regex, where the regex is created by the given closure.

## Declaration

```swift
func contains(@RegexComponentBuilder _ content: () -> some RegexComponent) -> Bool
```

## Parameters

- `content`: A closure that returns a regex to search for within this collection.

## Return Value

Return Value true if the regex returned by content matched anywhere in this collection, otherwise false.
