3.5. Searching for and Replacing text in files

3.5.1. Searching

To search for a text or regular expression string in the current file, choose Edit->Search->Find or press Ctrl-F. This will open the Find dialog.

Use the text box to specify the string to search for, and select whether it is a normal string or a regular expression (RegExp). It is also possible to specify the direction of search, whether the search is case-sensitive or not, and the scope of the search. Click Search to start searching.

If the search is successful, the matched text in the document will be highlighted, marked... (according to the search action choice). If the search is not successful, a match not found message will be displayed.

If you want to search again, click on the Search button on the main toolbar or press Ctrl-G. This will find the next match (Shift-Ctrl-G for the previous match). You can even change the search text when you do this. Enter the new string in the Search Expression text box in the main toolbar.

Figure 3-12. Search Text dialog

To stop a long research, choose Stop button.

If the "Basic Search and Replace" option is selected in the Setting window, the search direction can be choosen from the Expression window.

Figure 3-13. Basic Search Text dialog

3.5.2. Specifying Search Range

In the "Search Target dialog", define the search location and the action to be done in case of search success.

The maximum number actions can be defined by User.

Figure 3-14. Search Target dialog

The user can select where the text will be searched.

Figure 3-15. Search Target In choice

3.5.2.1. Searching in Files

To find text in your project, select "search in" All Project Files.

Enter the text you want to search and specify search options (case-sensitive, complete words ...). Click Search to start searching.

To find text in File list, select "search in" Specifying File List. Define the Search variables. Click Search to start searching.

Figure 3-16. Search File List

3.5.2.2. Specifying File Patterns

To find in files and/or folders, select "search in" Specify File Patterns, choose the file types and/or folders you want to search.

Remember, directories are searched recursively. All of the files under the directory, and the files under all the subdirectories, and the files under all of the sub-subdirectories (and so on) are all included in the search.

Enter the text you want to search and specify search options (case-sensitive, complete words ...). Click Search to start searching.

Figure 3-17. Search File Pattern

3.5.3. Specifying Search Action

The user selects which action will be done in case of search success.

According to the previous selections (Search in, Search direction ...), some actions coul be unavailable.

Figure 3-18. Search Target Action choice

3.5.4. Replacing

Search and replace is similar to just finding text, except that you also specify the replace text in the Replace Text text box, and whether or not you want to be prompted before the replace takes place (Replace First Match or Replace All Matches).

Figure 3-19. Replacing

Choose Replace to replace the matched text or Forward to jump to the next matched text.

3.5.5. Search Setting

The user has the possibility of saving the setting of his search options.

Item highlighted in red is the active item. Item by defaultt is the search setting which is loaded at Anjuta launching.

Figure 3-20. Search Setting dialog