---
title: "anchorsMatchLineEndings(_:)"
framework: swift
role: symbol
role_heading: Instance Method
path: "swift/regex/anchorsmatchlineendings(_:)"
---

# anchorsMatchLineEndings(_:)

Returns a regular expression where the start and end of input anchors (^ and $) also match against the start and end of a line.

## Declaration

```swift
func anchorsMatchLineEndings(_ matchLineEndings: Bool = true) -> Regex<Regex<Output>.RegexOutput>
```

## Parameters

- `matchLineEndings`: A Boolean value indicating whether ^ and $ should match the start and end of lines, respectively.

## Return Value

Return Value The modified regular expression.

## Discussion

Discussion This method corresponds to applying the m option in regex syntax. For this behavior in the RegexBuilder syntax, see Anchor.startOfLine, Anchor.endOfLine, Anchor.startOfSubject, and Anchor.endOfSubject.
