Contents

startOfLine

An anchor that matches at the start of a line, including the start of the input string.

Declaration

static var startOfLine: Anchor { get }

Discussion

This anchor is equivalent to ^ in regex syntax when the m option has been enabled or anchorsMatchLineEndings(true) has been called.

For example, the following regexes are all equivalent:

  • Regex { Anchor.startOfLine }

  • /(?m)^/ or /(?m:^)/

  • /^/.anchorsMatchLineEndings(true)