Finding and Replacing Elements

You can find and replace certain elements—custom tags, MadCap-specific features (e.g., drop-down text, concepts, equations), markup, inline styles, and style classes.

How to Find and Replace Elements

For more details about the fields and options, open the full topic.

  1. Select Home > Find and Replace. Then in the Find and Replace in Files window pane, click the Find Elements tab. Alternatively, you can press CTRL+N on your keyboard.
  2. In the Find field, click the first drop-down and select a type of element.
    • Tag
    • Class
    • Style ID
    • Inline Formatting
    • Attribute
  3. In the next field(s) to the right, enter or select one of the available options. The field(s) and options shown depend on your selection in the first drop-down.
  4. (Optional) If you want to add more criteria to the find, click Add Row and choose another type of element. Then complete the field(s) created as a result.
  5. In the Replace/Action field, click the first drop-down and select a type of action. If necessary, complete the field(s) shown to the right.
    •  Set Tag Adds the selected tag (selector) to the found area; can be used to replace one tag for another
    •  Remove Tag Removes the selected tag and its content from the found area
    •  Unbind Tag Removes the selected tag from the found area, but leaves the content (mostly useful when you have nested tags and want to remove one or more of them)
    •  Wrap Tag Places the selected tag around the found area (e.g., you might use this to place paragraphs within a <div> tag)
    •  Add Class Inserts the selected style class in the found area
    •  Remove Class Removes the selected style class from the found area
    •  Replace Class Lets you remove one class and replace it with another
    •  Remove Style ID Removes the selected style ID from the found area
    •  Set Style ID Adds the selected style ID to the found area; can be used to replace one style ID for another
    •  Remove Inline Formatting Removes the inline (local) formatting from the found area
    •  Set Inline Formatting Adds the inline (local) formatting you entered to the found area
    •  Remove Attribute Removes the selected attribute from the found area
    •  Set Attribute Adds the selected attribute to the found area
  6. Look at the Preview field to make sure the selected options will do what you expect.
  7. Click in the Find in field and select one of the options.

    • (current document) Looks for the text in the active document

    • (documents in the same folder) Looks for the text in all documents located in the same folder as the current one

    • (all open documents) Looks for the text in all documents currently open in the interface

    • (content folder) Looks for the text throughout files contained in the Content Explorer

    • (pick a folder) Lets you choose any folder in your project, confining the search to the files within that folder

    • (whole project) Looks for the text in files that are contained in the entire project

    • (reviews inbox) Looks for the text in files that are contained in the reviews inbox (Review > File Reviews)

  8. Click in the File types field and select one of the options. This option is disabled if you have selected to look in the current document only.
    • All Supported Files Looks in all of the following file types
    • Topics Looks for elements only in topic files
    • Snippets Looks for elements only in snippet files
    • Micro Content Looks for elements only in micro content files
    • Template Pages Looks for elements only in template page files
  9. (Optional) You can expand Options and choose additional features.

    • Match case Finds only occurrences that match the case (e.g., uppercase, lowercase)
    • Create backup (Replace All) Creates backups of all edited files that are not open when using the Replace All feature; ignored for files in the reviews inbox (Review > File Reviews)
    • Results view (Find Next/Previous): Lets you choose how to display each instance found when using the Find Next or Find Previous features
      • Current view Displays found instance in whatever view (XML Editor or Text Editor) the file is currently shown in (if it is already open)
      • XML editor Displays each instance found in the XML Editor
      • Text editor Displays each instance found in the Text Editor
    • Show results in (Find All):
      • Window 1 Displays the search results (list of files) in the Find Results 1 window pane when using the File All feature
      • Window 2 Displays the search results (list of files) in the Find Results 2 window pane when using the File All feature
  10. Click appropriate button(s) to take action.
    • Find Next Locates the next occurrence of the element
    • Find Previous Locates the previous occurrence of the element
    • Skip File Skips searching in the current file and moves on to the next one
    • Find All Finds and lists all occurrences of the element in the Find Results window pane at the bottom of the user interface

      The label on this button changes to "Stop Find" while a search is being processed. This is one way to tell that a search is in progress. Another way is to watch the counter in the Find Results window pane. This shows how many occurrences of matching text have been found; if the number continues to go higher, the search is still in progress.

    • Replace Replaces only the current instance
    • Replace All Replaces all of the matches in all files included in the search

      If matches are found in files that are already open, Flare replaces the text in those files and "dirties" them (i.e., an asterisk is shown in the tab, indicating the file has been changed and needs to be saved). Therefore, you can undo the changes if necessary in each of those files or save them. As for files that are not already open in the user interface, Flare does not open them at all. Instead, it simply replaces all of the matching text it finds and automatically saves those files. Therefore, you cannot undo those changes because the files were never opened.

      Warning Exercise caution when you tell Flare to "Replace All." Because changes are made and files are saved automatically, and because files with matches are not automatically opened, it is possible that you could introduce invalid code, therefore breaking files. Therefore, you might consider making a backup of your project before performing a find and replace like this. If your project is bound to a source control client, you may also be able to get a previous version of the files before they were broken.

      Warning If you have content that has been locked for editing (see Locking Elements) and you use the "Replace All" option, any matching content in those locked sections is replaced and the files are saved automatically.

    • [Progress Bar] A green bar at the bottom of the window pane shows the progress of the search.

Find Elements Examples

There are dozens of different combinations that you can use on the Find Elements tab. Following are examples that illustrate just some of the tasks that you can accomplish with this feature: