GNU Info

Info Node: (emacs)Other Repeating Search

(emacs)Other Repeating Search


Prev: Replace Up: Search
Enter node , (file) or (file)node

Other Search-and-Loop Commands
==============================

   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', all operate on the text from point to the end of the buffer,
or on the active region in Transient Mark mode.

`M-x occur <RET> REGEXP <RET>'
     Display a list showing each line in the buffer that contains a
     match for REGEXP.  To limit the search to part of the buffer,
     narrow to that part (Note: Narrowing).  A numeric argument N
     specifies that N lines of context are to be displayed before and
     after each matching line.

     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.

`M-x list-matching-lines'
     Synonym for `M-x occur'.

`M-x how-many <RET> REGEXP <RET>'
     Print the number of matches for REGEXP that exist in the buffer
     after point.  In Transient Mark mode, if the region is active, the
     command operates on the region instead.

`M-x flush-lines <RET> REGEXP <RET>'
     Delete each line that contains a match for REGEXP, operating on
     the text after point.  In Transient Mark mode, if the region is
     active, the command operates on the region instead.

`M-x keep-lines <RET> REGEXP <RET>'
     Delete each line that _does not_ contain a match for REGEXP,
     operating on the text after point.  In Transient Mark mode, if the
     region is active, the command operates on the region instead.

   You can also search multiple files under control of a tags table
(Note: Tags Search) or through Dired `A' command (Note: Operating on
Files), or ask the `grep' program to do it (Note: Grep Searching).


automatically generated by info2www version 1.2.2.9