Here are some other commands that find matches for a regular
expression. They all ignore case in matching, if the pattern contains
no upper-case letters and case-fold-search is non-nil.
Aside from occur and its variants, all operate on the text from
point to the end of the buffer, or on the region if it is active.
occur can not correctly
handle multiline matches.
The buffer ‘*Occur*’ containing the output serves as a menu for finding the occurrences in their original context. Click Mouse-2 on an occurrence listed in ‘*Occur*’, or position point there and type <RET>; this switches to the buffer that was searched and moves point to the original of the chosen occurrence. o and C-o display the match in another window; C-o does not select it.
After using M-x occur, you can use next-error to visit
the occurrences found, one by one. Compilation Mode.
occur using the search string of the last incremental
string search. You can also run M-s o when an incremental
search is active; this uses the current search string.
occur, except it is able to search
through multiple buffers. It asks you to specify the buffer names one by one.
multi-occur, except the buffers to
search are specified by a regular expression that matches visited
file names. With a prefix argument, it uses the regular expression to match
buffer names instead.
If a match is split across lines, flush-lines deletes all those
lines. It deletes the lines before starting to look for the next
match; hence, it ignores a match starting on the same line at which
another match ended.
If a match is split across lines, this command keeps all those lines.