16 Search and Replace

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):

  1. In the left sidebar Menu, select Tools.
  2. Select Search and Replace.
  3. On the S&R page, enter word or phrase you wish to search for.
  4. Enter Replace string (leaving blank will just delete the word or phrase).
  5. 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. 
  6. 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.
Find the "Search and Replace" function
Find the “Search and Replace” function

 

Enter your search terms and preview
Enter your search terms and preview

 

An example of a search and replace preview
An example of a search and replace preview. Note the inconsistency in the final sample.

License

Icon for the Creative Commons Attribution 4.0 International License

Pressbooks User Guide Copyright © 2012 by Book Oven Inc. (Pressbooks.com) is licensed under a Creative Commons Attribution 4.0 International License, except where otherwise noted.

Share This Book