---
title: "init(_:_:_:)"
framework: regexbuilder
role: symbol
role_heading: Initializer
path: "regexbuilder/repeat/init(_:_:_:)-8cwmc"
---

# init(_:_:_:)

Creates a regex component that matches the given component repeated a number of times specified by the given range expression.

## Declaration

```swift
init<W, C1, C2, C3, C4, C5, C6, C7>(_ expression: some RangeExpression<Int>, _ behavior: RegexRepetitionBehavior? = nil, @RegexComponentBuilder _ componentBuilder: () -> some RegexComponent) where Output == (Substring, C1?, C2?, C3?, C4?, C5?, C6?, C7?)
```

## Parameters

- `expression`: A range expression specifying the number of times that component can repeat.
- `behavior`: The repetition behavior to use when repeating component in the match. If behavior is nil, the default repetition behavior is used, which can be changed from eager by calling repetitionBehavior(_:) on the resulting Regex.
- `componentBuilder`: A builder closure that creates the regex component to repeat.
