December 1999
Beginner
528 pages
11h 10m
English
You could say that the opposite of the ^ is the $, which lets us match a string or character at the end of the line. The dollar sign goes at the end of the word you want to match. Suppose we wanted to match all lines that end with the word trouble, this would do it:
trouble$
Similarly, using ld$ would return all words ending with ld at the end of each line.
If we wanted to match all empty lines, we could do this as follows:
^$
This says start at the beginning of the line, and end at the end of the line. As there is no pattern involved it will return only blank lines.
If we wanted to return lines that contained only one character, we could do this:
^.$
Unlike the blank lines example, ...
Read now
Unlock full access