<!--
{
  "availability" : [
    "iOS: 4.0.0 -",
    "iPadOS: 4.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.6.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSData/SearchOptions/anchored",
  "metadataVersion" : "0.1.0",
  "role" : "Type Property",
  "symbol" : {
    "kind" : "Type Property",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:@E@NSDataSearchOptions@NSDataSearchAnchored"
  },
  "title" : "anchored"
}
-->

# anchored

Search is limited to start (or end, if searching backwards) of the data object.

```
static var anchored: NSData.SearchOptions { get }
```

## Discussion

This option performs searching only on bytes at the beginning of the range (or the end when using [`backwards`](/documentation/Foundation/NSData/SearchOptions/backwards)). No match at the beginning or end means nothing is found, even if a matching sequence of bytes occurs elsewhere in the data object.

---

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)