---
title: "consuming(_:startingAt:in:)"
framework: swift
role: symbol
role_heading: Instance Method
path: "swift/customconsumingregexcomponent/consuming(_:startingat:in:)"
---

# consuming(_:startingAt:in:)

Process the input string within the specified bounds, beginning at the given index, and return the end position (upper bound) of the match and the produced output.

## Declaration

```swift
func consuming(_ input: String, startingAt index: String.Index, in bounds: Range<String.Index>) throws -> (upperBound: String.Index, output: Self.RegexOutput)?
```

## Parameters

- `input`: The string in which the match is performed.
- `index`: An index of input at which to begin matching.
- `bounds`: The bounds in input in which the match is performed.

## Return Value

Return Value The upper bound where the match terminates and a matched instance, or nil if there isn’t a match.
