Skip to main content

Global Replace Text with a Variable

With Paligo's find and replace feature, you can replace a commonly used term with a variable. This is useful if you know a term has been used many times in your content, but it was not created as a variable. For example, if you import content from another format, you might want to replace all instances of a business name with a variable for the business name. Once the variable is in place, you can edit all of the instances at once by making the change to the variable.

Note

In the following procedure, you will need to create a Variable Set and add a variable and variant to it. If you are unfamiliar with setting up Variable Sets and variables, you can find more information in Create a Variable Set.

To do a global search for text and replace it with a variable:

  1. Create a new Variable Set.

    Close up of Content Manager. A callout arrow points at the Variable sets option.
  2. Add a variable to the set, for example, a text variable for a business name. When you add the variable, give it a name that describes what the variable is, for example, "business name", "slogan", "product name".

    New Variable Set with a variable added to it. The variable is called Business Name and it is in the left column of a 3 column table.
  3. Enter a variant for the variable. This is where you define the text that will appear in your topics, where the variable is used. For example, if you had a business name variable, you could have "Acme industries" as a variant.

    New Variable Set with a variable and variant added to it. The variable is called Business Name and it is in the left column of a 3 column table. The variant is in the middle column and it has a value of Acme Industries.
  4. Open a topic that contains the text that you want to replace.

  5. Add a variable to the topic.

    1. Select Insert and then Variable.

    2. Choose your Variable Set and then select the variable you want to use.

  6. Select the Edit menu and then select the Edit Source Code icon.

    Close up of Editor menu bar. A callout arrow points to the source code editor icon, which is a backward angle bracket, a forward slash, and a forward angle bracket.
  7. In the Source Code, find the variable code. It is a phrase element and should look similar to this:

    <phrase xinfo:varset="210686" xinfo:variable="36"></phrase>

    The XML also shows a reference to the Variable Set and a reference to the variable in that set.

  8. Copy the entire phrase element code to your computer's clipboard.

  9. Select the search icon in the top-corner, near your avatar.

    Close up of top-right corner of Paligo editor. A callout arrow points to the magnifying glass search icon just below the profile avatar.
  10. Select the advanced search icon.

    Quick search bar. A callout arrow points to the advanced search icon (a funnel).
  11. Select the Replace tab.

  12. In the Find what field, enter the term that you want to replace with a variable.

    Replace tab in advanced search. There is a Find what field. A user has entered the words acme industries in the field.
  13. In the Replace with field, paste the phrase code for your variable.

    Replace tab in advanced search. There is a Replace with field. A user has pasted the xml for a phrase element that references a variable set and variable in the field.
  14. Select Search.

    Paligo presents a list of all the instances of the term.

  15. Check the box in the left column for each term that you want to replace.

    Replace tab of advanced search. It shows the results Paligo has found that match the Find what term. Callout arrows point to the checkboxes to the left of each result. To the right, there is a preview of how the XML will change if you go ahead with the replacement.
  16. Select Replace.

    Paligo replaces all of the selected terms with the variable.