In Pressbooks, you can search and replace across your entire book. However, this is a somewhat imperfect and irreversible function so use with caution!
It works as follows (see below for screenshots):
- In the left sidebar Menu, select Tools.
- Select Search and Replace.
- On the S&R page, enter word or phrase you wish to search for.
- Enter Replace string (leaving blank will just delete the word or phrase).
- Click “Preview Replacements” to see what will get replaced
NOTE: While you get a complete list of terms to be replaced, you cannot select which ones will get replaced; it’s all or nothing, and there is no easy way to undo a mass replacement, other than going chapter by chapter.
- Click “Replace & Save” to make it happen.
Things to be aware of:
- The search is case sensitive. This means that in order to ensure that you find every instance of a word, you may need to run a search and replace several times (once all lower case, once with the first letter capitalized and once in all caps).
- Every instance of your search term will be found, even if it is part of another word. For example, searching for “he said” will also highlight part of “she said“, or searching for “book” would also highlight part of “Pressbooks” and change it just the same (see screenshot below).
- If you’re searching for something that appears very frequently in your book, it can easily overwhelm the system and not return any results. There’s no easy solution for this except to copy your book into a text editor such as Word or Notepad++, run the search and replace, and import or copy it all back in.