Skip to main content

How do I find and replace content in web pages?

Use the find and replace feature to search your website for specific words or phrases and, optionally, replace them with another word or phrase. This feature is useful when you want to:

  • Identify pages on your site containing a word or phrase so you can edit the relevant pages manually.
  • Replace a short phrase with another – for example, when a module name changes.
  • Replace instances of an old, broken URL with the correct URL.
  1. Browse to the page beneath which you want to perform the find and replace.
  2. Go to Edit > More > Current page tab.
  3. In the Manage content section, select Find and replace. You now see the Find/replace options:

    Find and replace options

  4. In the Find box, type the word or phrase you want to find.

    Note: by default, any word in the Find text box is matched. This is a normal text search; it's not a Boolean search. For example, if you enter modules AND 2007, and leave the checkbox Match whole phrase unselected, SiteBuilder returns matches for any of the three words modules AND 2007 – not pages containing both modules and 2007.
  5. At this point, if you only want to identify pages containing the word or phrase – i.e. to investigate manually rather than replace automatically – select the Find button.

    Note: you don't need to specify text in the Replace with text box if you just want to perform a ‘find’ operation. However, if you leave Replace with empty and choose to go ahead with the ‘replace’ step later, the found text will be removed i.e. replaced with nothing.

    You should now see a list of pages, with buttons alongside each page containing the found word or phrase:

    List of pages containing the word or phrase in the find query

  6. Select the Show n matches button to see the found words highlighted in the current content.
  7. Select the Preview removal button to preview the page in a new window. This shows what the content will look like should you choose to go ahead with the removal.
  8. To go ahead and remove all matches, select the Remove matches button.
  9. Alternatively, select the Edit search button to return to the Find and replace screen.
  10. Enter the word or phrase you want to find in the Find text box.
  11. Enter the word or phrase you wish to replace it with in the Replace with text box.
  12. Select the appropriate checkbox to specify whether the find query is case sensitive.
  13. Select the appropriate checkbox to specify whether the find query should match the whole phrase or any word.
  14. Define the scope of the find and replace operation by selecting one of the following options from the Pages to search drop-down menu:

    • Current page and all sub-pages (default)
    • Current page and all sub-pages in the same site
    • Current page only
  15. Specify how the find and replace operation applies to your pages by selecting the relevant radio button:
    • Apply changes only to the content of the pages – i.e. the centre, right or surrounding content.
    • Apply changes to the content and the page properties of the pages – i.e. the centre, right or surrounding content, plus the page heading, link caption, title bar caption, description and keywords in page properties.
  16. By default the find and replace operation applies solely to text in a page. E.g. the link caption text is found but the URL it points to is not. To include non-visible text in the find and replace operation (including alt text), select the checkbox Include image, link and embedded media descriptions and URLs.
  17. Optionally, expand the Advanced options and select the relevant checkbox for:
    • Use regular expressions – this is for those familiar with regular expressions; use with care.
    • Match raw HTML – select this to find and replace in the raw HTML without any of the restrictions mentioned in steps 15 and 16. When you select Match raw HTML, the option to Include image, link and embedded media descriptions and URLs is disabled.

      Note: use Match raw HTML with caution. Changing HTML can cause a page to not display correctly.

  18. When you have finished specifying the options, select the Find button. You should now see a report listing every page searched, with the number of matches:

    Find and replace preview

  19. Review the matches.
  20. When you have finished previewing how the pages will change, either:

    • Perform the replace operation by selecting the Replace matches button
    • Go back and edit your ‘find’ options by selecting the Edit search button

Note: be sure that you are happy with the preview of changes. If you go ahead with the ‘replace’ operation, you cannot undo it in a single operation. To undo the changes requires visiting each page and restoring the previous version via the page history.

 

Support

Telephone 73737
Email webteam at warwick dot ac dot uk
How to report a problem