(emacs)Other Repeating Search
Prev: Replace Up: Search
Other Search-and-Loop Commands
Here are some other commands that find matches for a regular
expression. They all operate from point to the end of the buffer.
`M-x occur RET REGEXP RET'
Print each line that follows point and 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.
The buffer `*Occur*' containing the output serves as a menu for
finding the occurrences in their original context. Find an
occurrence as listed in `*Occur*', position point there and type
`C-c C-c'; this switches to the buffer that was searched and moves
point to the original of the same occurrence.
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
`M-x keep-lines RET REGEXP RET'
Delete each line that follows point and does not contain a match
automatically generated by info2www