PREV UP next Regex

3.9.2: The Match-end-of-line Operator ($)

This operator can match the empty string either at the end of the string or before a newline character in the string. Thus, it is said to anchor the pattern to the end of a line.

It is always represented by $. For example, foo$ usually matches, e.g., foo and, e.g., the first three characters of foo\nbar.

Its interaction with the syntax bits and pattern buffer fields is exactly the dual of ^'s; see the previous section. (That is, ``beginning'' becomes ``end'', ``next'' becomes ``previous'', and ``after'' becomes ``before''.)