<!--
{
  "availability" : [
    "iOS: 16.0.0 -",
    "iPadOS: 16.0.0 -",
    "macCatalyst: 16.0.0 -",
    "macOS: 13.0.0 -",
    "tvOS: 16.0.0 -",
    "visionOS: -",
    "watchOS: 9.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Swift",
  "identifier" : "/documentation/RegexBuilder/Repeat/init(_:_:_:)-3mo6",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "RegexBuilder"
    ],
    "preciseIdentifier" : "s:12RegexBuilder6RepeatVyACySs_qd_0_Sgqd_1_Sgqd_2_Sgqd_3_Sgqd_4_Sgqd_5_Sgqd_6_Sgqd_7_Sgqd_8_Sgqd_9_SgtGqd_10__qd_11_17_StringProcessing0A18RepetitionBehaviorVSgtcSs_AdefghijklMtRszAO0A9ComponentRd_10_SXRd_11_qd___qd_0_qd_1_qd_2_qd_3_qd_4_qd_5_qd_6_qd_7_qd_8_qd_9_t0A6OutputRtd_10_Si5BoundRtd_11_r11_lufc"
  },
  "title" : "init(_:_:_:)"
}
-->

# init(_:_:_:)

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

```
init<W, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10>(_ component: some RegexComponent, _ expression: some RangeExpression<Int>, _ behavior: RegexRepetitionBehavior? = nil) where Output == (Substring, C1?, C2?, C3?, C4?, C5?, C6?, C7?, C8?, C9?, C10?)
```

## Parameters

`component`

The regex component to repeat.

`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`.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)