---
title: "init(as:_:)"
framework: regexbuilder
role: symbol
role_heading: Initializer
path: "regexbuilder/capture/init(as:_:)-6esnr"
---

# init(as:_:)

Creates a capture for the given component using the specified reference.

## Declaration

```swift
init<W, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10>(as reference: Reference<W>, @RegexComponentBuilder _ componentBuilder: () -> some RegexComponent) where Output == (Substring, W, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10)
```

## Parameters

- `reference`: The reference to use for anything captured by component.
- `componentBuilder`: A builder closure that generates a regex component to capture.
