## Finding and Replacing Text

The Search menu contains a number of commands for finding and replacing text.

The Find... and Replace... commands present dialogs for entering text for searching and replacing. These dialogs also allow you to choose whether you want the search to be sensitive to upper and lower case, or whether to use the standard Unix pattern matching characters (regular expressions). Searches begin at the current text insertion position.

Find Again and Replace Again repeat the last find or replace command without prompting for search strings. To selectively replace text, use the two commands in combination: Find Again, then Replace Again if the highlighted string should be replaced, or Find Again again to go to the next string.

Find Selection searches for the text contained in the current primary selection (see Selecting Text). The selected text does not have to be in the current editor window, it may even be in another program. For example, if the word dog appears somewhere in a window on your screen, and you want to find it in the file you are editing, select the word dog by dragging the mouse across it, switch to your NEdit window and choose Find Selection from the Search menu.

Find Incremental, which opens the interactive search bar, is yet another variation on searching, where every character typed triggers a new search. After you've completed the search string, the next occurrence in the buffer is found by hitting the Return key, or by clicking on the icon to the left (magnifying glass). Holding a Shift key down finds the previous occurrences. To the right there is a clear button with an icon resembling "|<". Clicking on it empties the search text widget without disturbing selections. A middle click on the clear button copies the content of any existing selection into the search text widget and triggers a new search.

### Searching Backwards

Holding down the shift key while choosing any of the search or replace commands from the menu (or using the keyboard shortcut), will search in the reverse direction. Users who have set the search direction using the buttons in the search dialog, may find it a bit confusing that Find Again and Replace Again don't continue in the same direction as the original search (for experienced users, consistency of the direction implied by the shift key is more important).

### Selective Replacement

To replace only some occurrences of a string within a file, choose Replace... from the Search menu, enter the string to search for and the string to substitute, and finish by pressing the Find button. When the first occurrence is highlighted, use either Replace Again (^T) to replace it, or Find Again (^G) to move to the next occurrence without replacing it, and continue in such a manner through all occurrences of interest.

To replace all occurrences of a string within some range of text, select the range (see Selecting Text), choose Replace... from the Search menu, type the string to search for and the string to substitute, and press the "R. in Selection" button in the dialog. Note that selecting text in the Replace... dialog will unselect the text in the window.

### Replacement in Multiple Documents

You can do the same replacement in more than one document at the same time. To do that, enter the search and replacement string in the replacement dialog as usual, then press the 'Multiple Documents...' button. NEdit will open another dialog where you can pick any document in which the replacement should take place. Then press 'Replace' in this dialog to do the replacement. All attributes (Regular Expression, Case, etc.) are used as selected in the main dialog.