How do I search for text in one of my files?

There are a few different search mechanisms available to you in emacs.

To simply search for a string of text you can execute the search function from the menu bar using Search...Search... or Search...Search Backwards...  These functions display a prompt for the search string in the mini-buffer.  Enter the string you are looking for and hit return.  On the menu bar, Search...Repeat Search will repeat the last search.  After exiting a forward or backward search you can recall a previous search string by starting a search and using the up and down cursor keys to scan through the search history

Emacs also has an incremental search.  This searches for strings in the current buffer moving the cursor to the next location that has matched the string entered so far.   You start an incremental search forward (backward) using C-s (C-r).  This displays the prompt


in the mini-buffer.  As you type characters the search function displays the string being matched in the mini-buffer.  As characters are entered the cursor will move through the current buffer and the buffer will redisplay at the location of the first match on the string.   If a match is found, entering C-s (C-r) without typing a new character will find the next forward (backward) match of the current string.  If a match is found, C-g will terminate the search and place the cursor at the location in the buffer where the incremental search began.  <ret> will cancel the search and leave the cursor at the location found.  You can also cancel the search remaining at the last location by preforming any cursor motion command.  If a search failed, C-g will cancel search input back to the last successful search.

After exiting an incremental search operation enter C-s (C-r) twice, without entering any search characters in between, to repeat a previous forward (backward) search.

Regular expression searching provides the most powerful search capability in Emacs. (See the description of regular expressions in Chapter 19 of Harley Hahn's Student Guide to Unix.)   You start a regular expression forward search from the menu bar with Search...Regexp search... or for a backwards search Search...Regexp search backwards...   Enter the regular expression and hit return.  The cursor will move forward or backward to a string in the buffer that matches the regular expression.  Regular expression searches can be repeated with the menu entries Search...Repeat Regexp and Repeat Regexp Backwards.

By default searching in Emacs in not case sensitive.  This can be changed from the menu bar with Help...Options...Case folding in searches.

version 1.3, 2000/09/20 20:25:26, by csfac@RIT. All rights reserved.