---
title: "starts(with:)"
framework: swift
role: symbol
role_heading: Instance Method
path: "swift/bidirectionalcollection/starts(with:)-97xlm"
---

# starts(with:)

Returns a Boolean value indicating whether the initial elements of this collection are a match for the regex created by the given closure.

## Declaration

```swift
func starts(@RegexComponentBuilder with content: () -> some RegexComponent) -> Bool
```

## Parameters

- `content`: A closure that returns a regex to match at the beginning of this collection.

## Return Value

Return Value true if the initial elements of this collection match regex returned by content; otherwise, false.
