Here are some other commands that find matches for a regular
expression. They all operate from point to the end of the buffer, and
all ignore case in matching, if the pattern contains no upper-case
letters and case-fold-search
is non-nil
.
M-x occur RET regexp RET
|
Display a list showing each line in the buffer that contains a match for regexp. A numeric argument specifies the number of context lines to print before and after each matching line; the default is none. To limit the search to part of the buffer, narrow to that part (see Narrowing).
The buffer ` |
M-x list-matching-lines | Synonym for M-x occur. |
M-x count-matches RET regexp RET
|
Print the number of matches for regexp after point. |
M-x flush-lines RET regexp RET
|
Delete each line that follows point and contains a match for regexp. |
M-x keep-lines RET regexp RET
|
Delete each line that follows point and does not contain a match for regexp. |
In addition, you can use grep
from Emacs to search a collection
of files for matches for a regular expression, then visit the matches
either sequentially or in arbitrary order. See Grep Searching.
Replace
Search