<!--
{
  "availability" : [
    "iOS: 2.0.0 -",
    "iPadOS: 2.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.0.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSRegularExpression/MatchingOptions",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:@E@NSMatchingOptions"
  },
  "title" : "NSRegularExpression.MatchingOptions"
}
-->

# NSRegularExpression.MatchingOptions

The matching options constants specify the reporting, completion and matching rules to the expression matching methods. These constants are used by all methods that search for, or replace values, using a regular expression.

```
struct MatchingOptions
```

## Topics

### Constants

[`NSMatchingReportProgress`](/documentation/Foundation/NSRegularExpression/MatchingOptions/reportProgress)

Call the Block periodically during long-running match operations. This option has no effect for methods other than [`enumerateMatches(in:options:range:using:)`](/documentation/Foundation/NSRegularExpression/enumerateMatches(in:options:range:using:)). See [`enumerateMatches(in:options:range:using:)`](/documentation/Foundation/NSRegularExpression/enumerateMatches(in:options:range:using:)) for a description of the constant in context.

[`NSMatchingReportCompletion`](/documentation/Foundation/NSRegularExpression/MatchingOptions/reportCompletion)

Call the Block once after the completion of any matching. This option has no effect for methods other than [`enumerateMatches(in:options:range:using:)`](/documentation/Foundation/NSRegularExpression/enumerateMatches(in:options:range:using:)). See [`enumerateMatches(in:options:range:using:)`](/documentation/Foundation/NSRegularExpression/enumerateMatches(in:options:range:using:)) for a description of the constant in context.

[`NSMatchingAnchored`](/documentation/Foundation/NSRegularExpression/MatchingOptions/anchored)

Specifies that matches are limited to those at the start of the search range. See [`enumerateMatches(in:options:range:using:)`](/documentation/Foundation/NSRegularExpression/enumerateMatches(in:options:range:using:)) for a description of the constant in context.

[`NSMatchingWithTransparentBounds`](/documentation/Foundation/NSRegularExpression/MatchingOptions/withTransparentBounds)

Specifies that matching may examine parts of the string beyond the bounds of the search range, for purposes such as word boundary detection, lookahead, etc. This constant has no effect if the search range contains the entire string. See [`enumerateMatches(in:options:range:using:)`](/documentation/Foundation/NSRegularExpression/enumerateMatches(in:options:range:using:)) for a description of the constant in context.

[`NSMatchingWithoutAnchoringBounds`](/documentation/Foundation/NSRegularExpression/MatchingOptions/withoutAnchoringBounds)

Specifies that `^` and `$` will not automatically match the beginning and end of the search range, but will still match the beginning and end of the entire string. This constant has no effect if the search range contains the entire string. See [`enumerateMatches(in:options:range:using:)`](/documentation/Foundation/NSRegularExpression/enumerateMatches(in:options:range:using:)) for a description of the constant in context.

## Relationships

### Conforms To

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

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

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

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

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

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

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

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

---

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)