<!--
{
  "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/RegexSemanticLevel",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "Swift"
    ],
    "preciseIdentifier" : "s:17_StringProcessing18RegexSemanticLevelV"
  },
  "title" : "RegexSemanticLevel"
}
-->

# RegexSemanticLevel

A semantic level to use during regex matching.

```
struct RegexSemanticLevel
```

## Overview

The semantic level determines whether a regex matches with the same
character-based semantics as string comparisons or by matching individual
Unicode scalar values. See [`matchingSemantics(_:)`](/documentation/Swift/Regex/matchingSemantics(_:)) for more about
changing the semantic level for all or part of a regex.

## Topics

### Operators

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

Returns a Boolean value indicating whether two values are equal.

### Instance Properties

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

The hash value.

### Instance Methods

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

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

### Type Properties

[`static var graphemeCluster: RegexSemanticLevel`](/documentation/Swift/RegexSemanticLevel/graphemeCluster)

Match at the character level.

[`static var unicodeScalar: RegexSemanticLevel`](/documentation/Swift/RegexSemanticLevel/unicodeScalar)

Match at the Unicode scalar level.

### Default Implementations

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

## Relationships

### Conforms To

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

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

---

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)