Replace dialog

Key point: Search and replace text in one or more documents.

There is no automated undo once you have clicked the Replace/Replace X selected button!

Changes can be manually reverted in the fragment history panel or document history panel, or in some cases, the replacement can be searched again. Individual documents can also be reverted to a previous version. It’s not possible to revert a complete publication.

Click the Search and replace... button to open the dialog.

The dialog is divided into three main parts:

  1. The top of the dialog has fields to specify your search and replacement terms and the folder or publication to search in.
  2. The middle of the dialog displays the matching results for the search, which can be individually selected for batch replacement.
  3. The bottom of the dialog displays a preview of replacements for a fragment that has been clicked in the middle of the dialog. For optional finer control, a Replace button is also available for the previewed fragment.

Limitations: You cannot replace words or content within xrefs or words with mixed markup, for example, if some part of a word is bold or italic.

Specify your search

Search for field

Enter your search term or phrase in the Search for field at top left.

You can toggle the options to refine how your terms are matched.

  • case sensitive – toggle to match exact case for both the search term and its replacement.
  • match word – toggle to match any part of the content instead of matching words.

By default, the search is not case sensitive but replacements preserve capitalization.

For example, searching “this” matches both “this” and “This”. If you enter “that” as the replacement, matching terms are replaced by either “that” or “That” depending on whether the original term is capitalized or not.

The match word option is on by default. It lets PageSeeder know to respect word boundaries, so that the terms you entered match exactly the beginning and the end of a word.

For example, searching “cat” matches only the word “cat” when the match word option is on, but it would also match “category” and “communicate” if you turn that option off.

Although the match word option returns results similar to the regular search, be careful with spaces and punctuation.

For developers: In developer view, you can also use the regex option to search for a regular expression instead of a specific term. When using regular expressions, you can use $1, $2, etc. to refer to a sub-matched string.

Replace with field

Enter your replacement term in the Replace with field on the top right.

If no replacement is entered, the searched term is replaced by nothing, so effectively removed.

You can change the replacement while you are previewing a matching result. The preview is updated automatically.

Location

From Documents page

The default location is the group folder, but you can navigate to a different folder in the folders panel before clicking the Search and replace... button. To search in another location, you can do one of the following in the Location field:

  • Click a folder name or icon to navigate to a different folder.
  • Click the icon on the right of the field and click an option from the drop-down.
  • Click the icon then click the wanted folder. To abandon selecting a different location, either click the X at the top right or press ESC.

From Document search panel

If Search documents in this publication only is selected, the default location is the current publication. You see the icon to the left of the location field is active and you see the title of the publication root document in the location field. If the current group has more than one publication, you can click the icon on the right of the location field and click another publication in the drop-down. Results for all documents in that publication display in the matching results area.

Switch between searching a folder or a publication by clicking the icon or the icon respectively.

Click the Search button to the right of the Location field to display matching results.

Matching results

Fragments that match search terms are listed individually.

Search results are different from normal search as fragments are returned instead of documents. Words and characters ignored by regular search are matched (Common words like “the”, “of” as well as punctuation), and the whole string is matched.

For each match, the following is shown:

  • Checkbox – click to select the fragment.
  • Extract – highlighting at least the first matched term in the fragment.
  • Number of matches – if more than one match in the fragment.
  • Title of the document – to the right.

Selecting multiple checkboxes enables batch replacement when the Replace X selected button at the bottom of the dialog is clicked. When using batch replacement, all the matched terms in the selected fragments are replaced.

Clicking on a fragment extract, with or without its checkbox selected, allows a preview of any possible replacements in the fragment.

Replace preview

The document title and fragment number are shown at the top left of the preview. Clicking the title opens the document in a new window.

The effect of replacement of the matched terms is displayed with highlighting. Clicking a term changes the color. The following colors indicate what action is to take place:

  • YELLOW – indicates no change is to occur.
  • RED – indicates a removal, only if there is no replacement value.
  • GREEN – indicates a replacement, only if there is a replacement value.

Clicking the Replace button carries out the chosen actions on the fragment and automatically updates the matching terms in the preview.

If the search, location, or publication details are changed after an extract has been clicked, the user has to click the Search button again to update the preview.

Replace edit note

When you replace a term using the search and replace dialog, an edit note is attached to every fragment where a term was replaced so that you can see what happened in the fragment history panel.

How to find this page

On the documents page:

Navigation menu > Group > Documents, then click the Search and replace button at the top right.

In the document search panel:

When viewing a document, click the icon in the left sidebar. Optionally enter a search term here in the panel, or in the dialog after you click the Search and replace button.