---
title: "trimmingPrefix(_:)"
framework: swift
role: symbol
role_heading: Instance Method
path: "swift/bidirectionalcollection/trimmingprefix(_:)-1luge"
---

# trimmingPrefix(_:)

Returns a new collection of the same type by removing the initial elements that matches the given regex.

## Declaration

```swift
func trimmingPrefix(_ regex: some RegexComponent) -> Self.SubSequence
```

## Parameters

- `regex`: The regex to remove from this collection.

## Return Value

Return Value A collection containing the elements that does not match regex from the start.
