regex anchor

A regular expression symbol that matches a position rather than a character: ^ for the start of a line and $ for the end.

In more detail

Anchors stop a pattern matching in the middle of a line, so ^- finds lines that begin with a dash and ^$ finds empty lines. Some tools add word anchors too, such as \b in grep.

Example

grep -n '^-' notes/*.md

Related terms

Taught in

References