How do I search for a word at the beginning of lines or a word at the end of lines?
Using regular expression
In regular expression, the metacharacter ^
represents the beginning of a line and $
represents the end of a line. In the Find dialog, use the Regular Expressions option. If you enter ^Search String
, it will find an instance of of “Search String” at the beginning of a line and Search String$
will find an instance of “Search String” at the end of a line.
Using escape sequence
If you change the find type to Escape Sequence, a new line is represented as \n
. Enter \nSearch String
in the Find field if you want to find “Search String” at the beginning of a line, or Search String\n
if you want to find “Search String” at the end of a line.