Anchor

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

iOS
16.0+
macOS
13.0+
tvOS
16.0+
watchOS
9.0+

You’re reading documentation from an older version of Swift 6.1.

A symbol with the same signature as this one exists in the latest stable release of Swift 6.1.

struct Anchor

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.