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/*.mdRelated terms
- regular expression — A pattern language for matching text, where characters such as ., *, ^ and $ have special meanings.
- grep — The command that prints the lines of its input that match a pattern.
Taught in
- Finding Lines: grep And Regular Expressions — Bash Scripting & Command Line Automation