Finding and replacing text and formatting

When looking for certain words in a 3000-word essay, it would be inefficient (and close to impossible!) to go through every word manually. Writer has a Find and Replace feature that automates the process of searching for text inside a document.

In addition to finding and replacing words and phrases, you can:

  • Find and replace specific formatting.
  • Find and replace paragraph styles.
  • Use wildcards and regular expressions to fine-tune a search.

To display the Find & Replace dialog, use the keyboard shortcut Control+F or select Edit > Find & Replace.

Expanded Find & Replace dialog

Expanded Find & Replace dialog

  1. Type the text you want to find in the Search for box.
  2. To replace the text with different text, type the new text in the Replace with box.
  3. You can select various options, such as matching the case, matching whole words only, or doing a search for similar words. (See below for some other choices.)
  4. When you have set up your search, click Find. To replace text, click Replace instead.

Tip: If you click Find All, Writer selects all instances of the search text in the document. Similarly, if you click Replace All button, Writer will replace all matches.

Caution: Use Replace All with caution; otherwise, you may end up with some hilarious (and highly embarrassing) mistakes. A mistake with Replace All might require a manual, word-by-word search to fix.

Find and replace specific formatting

A very powerful use of Find & Replace takes advantage of the format option. For example, you might want to replace underlined words with italics.

On the Find & Replace dialog (with More Options displayed:

  1. To search for text with specific formatting, enter the text in the Search for box. To search for specific formatting only, delete any text in the Search for box.
  2. Click Format to display the Text Format (Search) dialog box. The tabs on this dialog box are similar to those on the Paragraph format and Paragraph Style dialog boxes. Choose the formats you want to search for and then click OK. The names of selected formats appear under the Search for box. For example, you might search for all text in 14-point bold Helvetica.
  3. To replace text, enter the replacement text in the Replace with box.
    • To search for specific text with specific formatting (for example, the word hello in bold), specify the formatting, put the text in the Search for box and leave the Replace with box blank.
    • To remove specific character formatting, click Format, select the Font tab, then select the opposite format (for example, No Bold). The No Format button on the Find & Replace dialog box clears all previously selected formats.
  4. Click Find, Find All, Replace, or Replace All.

Tip: Unless you plan to search for other text using those same attributes, click No Format to remove the attributes after completing your search. If you forget to do this, you may wonder why your next search fails to find words you know are in the document.

Find and replace paragraph styles

If you combine material from several sources, you may discover that lots of unwanted paragraph styles have suddenly shown up in your document. To quickly change all the paragraphs of one (unwanted) style to another (preferred) style:

  1. On the expanded Find & Replace dialog box (), select Search for Styles. (If you have attributes specified, this checkbox is labeled Including Styles.) The Search for and Replace with boxes now contain a list of styles.
  2. Select the styles you want to search for and replace.
  3. Click Find, Find All, Replace, or Replace All.

Use wildcards (regular expressions)

Wildcards (also known as regular expressions) are combinations of characters that instruct OOo how to search for something. Regular expressions are very powerful but not very intuitive. They can save time and effort by combining multiple finds into one.

The online help describes many more regular expressions and their uses. Two of particular interest to writers are the end-of-paragraph marker (use $) and the line break (\n). Note: the $ works as a search character, but not as a replacement character; use \n instead.

Note: To search for a character that is defined as a wildcard, type a backslash (\) before the character. For example, to find the text $5.00, you would conduct a search using \$5\.00.

To use wildcards and regular expressions when searching and replacing:

  1. On the Find & Replace dialog, click More Options to see more choices. On this expanded dialog, select Regular expressions.
  2. Type the search text, including the wildcards, in the Search for box and the replacement text (if any) in the Replace with box. Not all regular expressions work as replacement characters; the line break (\n) is one that does work.
  3. Click Find, Find All, Replace, or Replace All (not recommended).

<< Previous section | Next section >>


This book is licensed under the terms of the Creative Commons Attribution License, version 3.0.

Share On Facebook
Share On Twitter
Share On Google Plus
Share On Linkedin

Categories

Archives