---
title: Anchor
framework: regexbuilder
role: symbol
role_heading: Structure
path: regexbuilder/anchor
---

# Anchor

A regex component that matches a specific condition at a particular position in an input string.

## Declaration

```swift
struct Anchor
```

## Overview

Overview You can use anchors to guarantee that a match only occurs at certain points in an input string, such as at the beginning of the string or at the end of a line.

## Topics

### Instance Properties

- [inverted](regexbuilder/anchor/inverted.md)

### Type Properties

- [endOfLine](regexbuilder/anchor/endofline.md)
- [endOfSubject](regexbuilder/anchor/endofsubject.md)
- [endOfSubjectBeforeNewline](regexbuilder/anchor/endofsubjectbeforenewline.md)
- [firstMatchingPositionInSubject](regexbuilder/anchor/firstmatchingpositioninsubject.md)
- [startOfLine](regexbuilder/anchor/startofline.md)
- [startOfSubject](regexbuilder/anchor/startofsubject.md)
- [textSegmentBoundary](regexbuilder/anchor/textsegmentboundary.md)
- [wordBoundary](regexbuilder/anchor/wordboundary.md)

## Relationships

### Conforms To

- [Copyable](swift/copyable.md)
- [Escapable](swift/escapable.md)
- [RegexComponent](swift/regexcomponent.md)

## See Also

### Components

- [CharacterClass](regexbuilder/characterclass.md)
- [Lookahead](regexbuilder/lookahead.md)
- [NegativeLookahead](regexbuilder/negativelookahead.md)
- [ChoiceOf](regexbuilder/choiceof.md)
