6 Overview
6.4 Searching and Replacing
Choose how you want to perform searches in SAP Web IDE. SAP Web IDE allows you to perform an advanced search and replace across multiple files in a project. You can also perform a simple string search within an open file in the code editor.
Searching for Files or Content in the Workspace [page 51]
Perform a file or string search within a folder or across all projects in your workspace. To determine the success of your search, use the preview to quickly validate results, and refine your search further as needed.
Replacing Strings Across Multiple Files [page 52]
Perform an advanced find and replace across multiple files with the Search pane.
Finding and Replacing in an Open File [page 54]
Perform a simple find and replace within a single open file from the code editor.
Task overview: Overview [page 42]
Related Information
Features and Benefits [page 44] Menus [page 47]
Working with Files and Folders [page 55] Resizing Window Panes [page 57]
6.4.1 Searching for Files or Content in the Workspace
Perform a file or string search within a folder or across all projects in your workspace. To determine the success of your search, use the preview to quickly validate results, and refine your search further as needed.
Context
Note
SAP Web IDE uses index-based searching. The results of an index-based search may not reflect all the latest changes made to a file because the search index may take several minutes until changes to files are recognized by the search. A longer response time for a search may be the result of network conditions and a large-sized workspace with many files.
Procedure
1. Choose Search Advanced Repository Search . 2. In the Search pane, define the type of search:
○ To search for a file, enter a full or partial file name, then choose File name.
○ To search for a string, enter the string, then choose File content. 3. (Optional) Refine search results further:
○ Set Search in to determine where the search scope is to be limited: use All to search across the entire workspace, use Project to search across a single project, or use Folder to search within the current directory. If you choose Folder or Project, type the path to the target that you want to search, or select it in the workspace.
○ Set Find to limit file or content searches to files with a specified extension. 4. Choose Search.
5. In the results list at the bottom of the Search pane, you see search results, organized according to file.
○ Expand or collapse files with results, which is useful when lists are long.
○ Below each file, matches are highlighted.
○ Hover over a specific result to get the context of that item.
If you do a search of file content for the string test, you might see results shown as in the following example. You can choose the /Test/ folder as the target, then change Find from all file types to *.js. Search results are limited to two files. By hovering over the first result in the first file, you can quickly review the context without opening the file.
6. When you have identified the file and row that you require, double-click the specific search result to open the file with the appropriate row highlighted.
Task overview: Searching and Replacing [page 50]
Related Information
Replacing Strings Across Multiple Files [page 52] Finding and Replacing in an Open File [page 54]
6.4.2 Replacing Strings Across Multiple Files
Perform an advanced find and replace across multiple files with the Search pane.
Procedure
1. With or without any files open in the code editor, open the Search pane as follows:
○ From the top menu bar, choose Search Advanced Repository Search .
○ Choose the search icon located on the right side of the editor. 2. In the Search pane, type the string you want to find.
3. (Optional) Refine search results further:
○ Set Search in to determine where the search scope is to be limited: use All to search across the entire workspace, use Project to search across a single project, or use Folder to search within the current directory. If you choose Folder or Project, type the path to the target that you want to search.
○ Set Find to limit searches to files with a specified extension. 4. Choose Search.
5. In the Replace pane, enter the replace text and perform one of the following:
○ A serial replace that allows you to evaluate each instance case-by-case. In the results list, hover over each result and click the replace icon at the end of the line to replace the string. As each instance is replaced, it disappears from the results list. Skip all results that you do not want to replace.
○ An inline replace that allows you to select only specific file results, and choose the replace icon adjacent to the result itself.
○ A global replace of all results in the list. Choose Replace All.
Note
You cannot undo the global replace operation.
Task overview: Searching and Replacing [page 50]
Related Information
Finding and Replacing in an Open File [page 54]
6.4.3 Finding and Replacing in an Open File
Perform a simple find and replace within a single open file from the code editor.
Context
These searches are limited to the file that is currently in view. To search and replace across multiple files, perform an advanced search. See Replacing Strings Across Multiple Files [page 52].
Procedure
1. Open the file that you want to perform a simple string search in. 2. Select Search Find and Replace .
3. Do one of the following:
○ To perform a basic search only, enter the search string in the search field (the first field). Use the adjacent up and down arrows to find instances previous to or following the current cursor location. Use the icons to further limit the search for:
○ Regular expressions
○ Case-sensitive
○ Whole words only
○ To replace text, enter both a search string and a Replace with string. To search and replace one by one, click Replace. If other instance exists, the next one will be selected. Otherwise, to automatically search and replace all instances, click All.
○
4. If you replaced strings, save the file.
Task overview: Searching and Replacing [page 50]
Related Information
Searching for Files or Content in the Workspace [page 51] Replacing Strings Across Multiple Files [page 52]