Position anchors

The operators in Table 10-7 match line position.

Table 10-7. Regular expression position anchors

Regular expression

Description

^

Match the beginning of a line.

$

Match the end of a line.

\<
\>

Match word boundaries. Word boundaries are defined as whitespace, start of a line, end of a line, or punctuation marks. The backslashes are required and enable this interpretation of < and >.

Get LPI Linux Certification in a Nutshell, 3rd Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.