In order to perform a find and replace action, search criteria need to be specified. The Find and Replace tool is available to Level 10 administrators and can be found at Content > Find and Replace. The Search Criteria screen allows users to specify the parameters for the find and replace actions. The screen is organized into the Options panel and the Scope panel. Field labels in bold are required.
The Options panel is used to input the basic criteria for a find or replace. It contains the following options:
- Type: Select between two types: Literal Text and Regular Expression (regex). For both types, the text and source code of a file are searched. The regex behavior is a whole-page search and matches white space throughout the document. For more information, visit the Regular Expressions page.
- Find: Input the text string or a regular expression. Performing the search will find all content within the site that matches the search.
- Ignore Case: Ignores case sensitivity for the find. For example, if instances of both "Gallena" and "gallena" exist, select the Ignore Case checkbox to find both; otherwise the search will locate the instances that match the correct case.
- Replace With: Specify the content that will replace the content that was defined in the Find field.
The use of leading, trailing, or mid-string spaces are honored when performing a literal text find and replace action. For example, searching for " d" would return the results " do" and " dog" but not "and".
If you perform a replace with nothing in the "Replace With" field, the found content will be deleted.
Find and Replace actions can be refined according to the options in the Scope panel. The Scope panel includes the following elements:
- Include Assets: When selected, the search will include Web Content, Source Code, and Plain Text assets. To perform an asset-only search, select the Include Assets checkbox, but do not select any files and folders. The asset itself is included in the search, but pages that subscribe to those assets will not be searched.
- Exclude Checked-Out Files: If this option is selected, checked-out content (either to the current user or another user) is excluded from the search. This excludes both pages and assets. This also excludes files in a workflow or with a scheduled action such as a publish or expire.
- File Extensions: One or more file extension types can be used to perform a find or replace action that excludes or includes specific file types. Extensions can be chosen from a drop-down or entered manually.
- Files and Folders: Select one or more files and folders on which to perform the find and replace action. The top checkbox next to the root folder will select or deselect all files and folders in the site.
Performing a Simple Find
The simplest way to see these features in action is through a literal text search. A find can be performed for the entire site or selectively delimited for specific directories and files. Literal text finds and replaces, by default, are case sensitive and search in the code and text of a file.
- Navigate to Content > Find and Replace.
- Choose Literal Text radio button if not already selected.
- In the Find field, enter the text to find.
- Click Find. In the results, the search string is shown in bold and purple font within the context of each file.
Previewing and Replacing
- After defining a search and clicking the Preview Replace button, review the Preview Replace Summary. This can be useful to ensure that the desired results are obtained for a replace before actually finalizing the action.
- The search string and replace string are shown in context in the Find Results list.
The search string is shown in red with a strike-through, and the replace string is
underlined and shown in green.
- Select the content on which to perform the replace. One or more files and directories can be selected. The results can be filtered, sorted by column, or paginated, and the context can be hidden with the Hide Source button.
- Optionally, export the results to CSV.
- If necessary, click the linked file to preview it.
- Click Replace.
- Enter a Version Description and click Replace to confirm the operation.
Note that this action only replaces the content on the staging server. Files must be published for the changes to be visible on the production server.
See the Replace Results topic for information on how to publish, version compare, and revert changes.