<!--
{
  "availability" : [
    "iOS: 16.0.0 -",
    "iPadOS: 16.0.0 -",
    "macCatalyst: 16.0.0 -",
    "macOS: 13.0.0 -",
    "tvOS: 16.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 9.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Swift",
  "identifier" : "/documentation/Swift/RegexRepetitionBehavior",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "Swift"
    ],
    "preciseIdentifier" : "s:17_StringProcessing23RegexRepetitionBehaviorV"
  },
  "title" : "RegexRepetitionBehavior"
}
-->

# RegexRepetitionBehavior

Specifies how much to attempt to match when using a quantifier.

```
struct RegexRepetitionBehavior
```

## Overview

See [`repetitionBehavior(_:)`](/documentation/Swift/Regex/repetitionBehavior(_:)) for more about specifying the default
matching behavior for all or part of a regex.

## Topics

### Operators

[`static func == (RegexRepetitionBehavior, RegexRepetitionBehavior) -> Bool`](/documentation/Swift/RegexRepetitionBehavior/==(_:_:))

Returns a Boolean value indicating whether two values are equal.

### Instance Properties

[`var hashValue: Int`](/documentation/Swift/RegexRepetitionBehavior/hashValue)

The hash value.

### Instance Methods

[`func hash(into: inout Hasher)`](/documentation/Swift/RegexRepetitionBehavior/hash(into:))

Hashes the essential components of this value by feeding them into the
given hasher.

### Type Properties

[`static var eager: RegexRepetitionBehavior`](/documentation/Swift/RegexRepetitionBehavior/eager)

Match as much of the input string as possible, backtracking when
necessary.

[`static var possessive: RegexRepetitionBehavior`](/documentation/Swift/RegexRepetitionBehavior/possessive)

Match as much of the input string as possible, performing no backtracking.

[`static var reluctant: RegexRepetitionBehavior`](/documentation/Swift/RegexRepetitionBehavior/reluctant)

Match as little of the input string as possible, expanding the matched
region as necessary to complete a match.

### Default Implementations

[Equatable Implementations](/documentation/Swift/RegexRepetitionBehavior/Equatable-Implementations)

## Relationships

### Conforms To

[`Equatable`](/documentation/Swift/Equatable)

[`Hashable`](/documentation/Swift/Hashable)

---

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)