<!--
{
  "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(_:count:)-8cqm4",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "RegexBuilder"
    ],
    "preciseIdentifier" : "s:12RegexBuilder6RepeatV_5countACySs_qd_0_Sgqd_1_Sgqd_2_Sgqd_3_SgtGqd_4__SitcSs_AefgHtRsz17_StringProcessing0A9ComponentRd_4_qd___qd_0_qd_1_qd_2_qd_3_t0A6OutputRtd_4_r4_lufc"
  },
  "title" : "init(_:count:)"
}
-->

# init(_:count:)

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

```
init<W, C1, C2, C3, C4>(_ component: some RegexComponent, count: Int) where Output == (Substring, C1?, C2?, C3?, C4?)
```

## Parameters

`component`

The regex component to repeat.

`count`

The number of times to repeat `component`. `count` must
be greater than or equal to zero.

---

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)