Searching for and Replacing Catalog Text Using Catalog Manager

You can search for specific text in the catalog and replace it with other text using Catalog Manager.

You can open the catalog in either online or offline mode. In offline mode, you can replace all objects. In online mode, you might be unable to replace certain objects, depending on your permissions.

Specifically, you can search for and replace:

  • A simple text string using a dialog, as described in Searching for and Replacing a Simple Catalog Text String.

    For example, suppose that an object contains the string "My Misspeled Wirds." You can use Catalog Manager to search and replace that string with the proper text of "My Misspelled Words."

  • Multiple or complex text strings all at the same time using an XML file, as described in Searching for and Replacing Multiple Catalog Text Strings.

    For example, suppose that the administrator renames a subject area, a table, or column in the repository file. The table "Sales" might be renamed "MySales." You can use Catalog Manager to search and replace all uses of that object throughout the catalog.

Searching for and Replacing a Simple Catalog Text String

You can search for a simple text string in the catalog and replace it with other text.

To search for and replace a simple text string:

  1. In Catalog Manager, open the catalog in either online or offline mode.
  2. From the Tools menu, select XML Search and Replace.
  3. In the Old text field, enter the text string to search for.
  4. In the Replace with field, enter the replacement text.
  5. To make the search case insensitive, deselect the Case Sensitive box.
  6. Click OK.

About Searching for and Replacing Multiple Catalog Text Strings

You can perform more powerful search and replace operations on multiple catalog text strings all at the same time by importing a XML file that identifies each text string to search for and replace.

XML File Format for Searching for and Replacing Text Strings

In the search and replace XML file, you use an action element to identify each text string to search for and replace.

The action elements are contained in a commands element. The action element has the following attributes:

  • command — Specifies the text to replace. The valid value is:

    • textReplace — Replaces all the text that matches in an XML file, such as a column name.

  • oldValue — Specifies the text string to search for.

    When you specify this attribute for the textReplace command for the search and replace XML file, you must use the full Java regex syntax, which is not like a normal string. To replace a string, you must do the following:

    1. Escape any special Java regex characters (such as brackets, parentheses, dollar signs, and carets).

    2. Escape any special "normal" string characters (such as back slashes and quotes).

    3. Because you are working in an XML file, escape any special HTML characters (such as quotes and ampersands).

    The full Java regex syntax is described in the following document:

    http://java.sun.com/j2se/1.5.0/docs/api/java/util/regex/Pattern.html

    The following table provides sample strings for use with the regex syntax in search criteria.

    Search String Entered Result

    a

    Adds wildcards before and after your search string (for example, *a*), enabling the search to return results that contain the letter "a".

    ^a

    Adds a wildcard after your search string (for example, a* ), enabling the search to return results that begin with the letter "a".

    a$

    Adds a wildcard before your search string (for example, *a ), enabling the search to return results that end with the character "a".

    a\*

    Searches explicitly for strings containing a character followed by an asterisk (*) for example, "a*".

    ?

    Use a question mark (?) with a character and an asterisk (*) to return zero (0) or more occurrences of a character. For example ?a* returns zero or more occurrences of the character "a".

  • newValue — Specifies the replacement text.

  • ignoreCase — Ignores case when set to true, but becomes case-sensitive when set to false. The default value is false.

Example XML File for Searching for and Replacing Text Strings

The following is a partial example of an XML file for searching for and replacing a text string.

<?xml version="1.0" encoding="utf-8"?>
<actions>
<action command="textReplace" oldValue="boots" newValue="HoleyShoes" ignoreCase="true"/>
</actions>

Searching for and Replacing Multiple Catalog Text Strings

Use the following procedure to search for and replace multiple catalog text strings all at the same time.

To search for and replace multiple text strings:

  1. Create the XML file for searching for and replacing multiple text strings.
  2. In Catalog Manager, open the catalog in offline mode.
  3. From the Tools menu, select XML Search and Replace.
  4. In the Import from File field, enter the path or click Browse to specify the XML file that you created in Step 1.
  5. To make the search case-sensitive, select the Case Sensitive box.
  6. Click OK.