Difference between revisions of "Documentation/OOo3 User Guides/Writer Guide/Finding and replacing"

From Apache OpenOffice Wiki
Jump to: navigation, search
 
(9 intermediate revisions by 4 users not shown)
Line 1: Line 1:
 
{{DISPLAYTITLE:Finding and replacing text and formatting}}
 
{{DISPLAYTITLE:Finding and replacing text and formatting}}
 +
[[ru:RU/documentation/ooo3_user_guides/writer_guide/finding_and_replacing]]
 
{{Documentation/WG3TextTOC
 
{{Documentation/WG3TextTOC
 
|ShowPrevNext=block
 
|ShowPrevNext=block
Line 5: Line 6:
 
|NextPage=Documentation/OOo3_User_Guides/Writer Guide/Special characters
 
|NextPage=Documentation/OOo3_User_Guides/Writer Guide/Special characters
 
}}__notoc__
 
}}__notoc__
當在3000字的文章尋找某些詞,效率可能低於手工打的每一個字。所以有了尋找和取代功能,可以自動搜索正在編輯的文件。
+
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:
  
除了尋找和取代單詞和短語,您可以:
+
* Use wildcards and regular expressions to fine-tune a search.
 +
* Find and replace specific formatting.
 +
* Find and replace paragraph styles.
  
* 使用符號和正則表達公式來搜尋
+
To display the Find & Replace dialog box, use the keyboard shortcut ''Control+F'' or select '''Edit > Find & Replace'''.
* 尋找和取代特定格式.
+
* 尋找和取代段落樣式
+
  
如何顯示尋找和取代對話框,請使用鍵盤快捷鍵Ctrl + F鍵 ,或者選擇編輯>“尋找和取代 。
+
# Type the text you want to find in the ''Search for'' box.
 
+
# To replace the text with different text, type the new text in the ''Replace with'' box.
# 在尋找框中輸入您要查找的資料。
+
# 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.)
# 若要替換與原本不同的文字,請取代框中輸入新文字。
+
# When you have set up your search, click '''Find'''. To replace text, click '''Replace''' instead.
# 您可以選擇不同的選項,如匹配的情況下,全字匹配,或做尋找類似的話。(見下文有其他選擇。)
+
# 當您設置您的尋找,點選查找 。 若要替換文字,就點選替代。
+
  
 
[[Image:FR-box.png|thumb|none|500px|''The Find & Replace dialog box'']]
 
[[Image:FR-box.png|thumb|none|500px|''The Find & Replace dialog box'']]
  
{{Documentation/Tip|如果您點選全部尋找 ,就會整份文件。 同樣,如果您點選全部替換 ,尋找的文字就會變成取代的文字,如果不是及時發現解開,取代所有錯誤可能需要手動。}}
+
{{Tip| If you click '''Find All''', Writer selects all instances of the search text in the document. Similarly, if you click '''Replace All''', Writer replaces all matches.}}
 +
 
 +
{{Warn| 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, if mistakes are not discovered in time to undo.}}
 +
 
 +
== 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 box with '''More Options''' displayed, follow the instructions below:
 +
 
 +
<ol> 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.
 +
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.
 +
To replace text as well as formatting, type the replacement text in the ''Replace with'' box.
 +
Click '''Find''', '''Find All''', '''Replace''', or '''Replace All'''.</ol>
 +
 
 +
== Find & Replace Specific Text & Formatting ==
 +
 
 +
* To search for specific text with specific formatting (for example, the word '''hello''' in bold), specify the formatting, type 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.
 +
 
 +
* 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:
 +
 
 +
# On the expanded Find & Replace dialog box, select '''Search for Styles'''. (If you have attributes specified, this option is labeled ''Including Styles''.) The'' Search for'' and ''Replace with'' boxes now contain a list of styles.
 +
# Select the styles you want to search for and replace.
 +
# Click '''Find, Find All''', '''Replace''', or '''Replace All'''.
 +
Repeat steps 2 and 3 for each style that you want to replace.
  
 
== Use wildcards (regular expressions) ==
 
== Use wildcards (regular expressions) ==
Line 29: Line 65:
 
Table 1 shows a few of the regular expressions used by OOo.
 
Table 1 shows a few of the regular expressions used by OOo.
  
{{Documentation/Tip| The online help describes many more regular expressions and their uses.}}
+
{{Tip| The online help describes many more regular expressions and their uses.}}
  
{{Documentation/Note| One of the most common mistakes when using regular expressions is to try to search for a character that is defined as a wildcard, such as brackets or dots. If you need to search for such a character, type a backslash (\) before it. This instructs OOo to treat the character following the backslash as a normal character. For example, to find the text $5.00 ($ and . are wildcard characters), you would conduct a search using \$5\.00.}}
+
{{Note| One of the most common mistakes when using regular expressions is to try to search for a character that is defined as a wildcard, such as brackets or dots. If you need to search for such a character, type a backslash (\) before it. This instructs OOo to treat the character following the backslash as a normal character. For example, to find the text $5.00 ($ and . are wildcard characters), you would conduct a search using \$5\.00.}}
  
 
To use wildcards and regular expressions when searching and replacing:
 
To use wildcards and regular expressions when searching and replacing:
Line 110: Line 146:
 
|}
 
|}
  
== 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 box with '''More Options''' displayed:
 
 
# 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.
 
# 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.
 
# To replace text, enter the replacement text in the ''Replace with'' box.<br />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.>br />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.
 
# Click '''Find, Find All''', '''Replace''', or '''Replace All'''.
 
 
{{Documentation/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:
 
 
# On the expanded Find & Replace dialog box, select '''Search for Styles'''. (If you have attributes specified, this option is labeled ''Including Styles''.) The'' Search for'' and ''Replace with'' boxes now contain a list of styles.
 
# Select the styles you want to search for and replace.
 
# Click '''Find, Find All''', '''Replace''', or '''Replace All'''.
 
  
  
 
{{CCBY}}
 
{{CCBY}}
 
[[Category:Writer Guide (Documentation)]]
 
[[Category:Writer Guide (Documentation)]]

Latest revision as of 21:25, 14 July 2018


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:

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

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

  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.
The Find & Replace dialog box
Tip.png If you click Find All, Writer selects all instances of the search text in the document. Similarly, if you click Replace All, Writer replaces all matches.


Documentation caution.png 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, if mistakes are not discovered in time to undo.

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 box with More Options displayed, follow the instructions below:

    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. 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. To replace text as well as formatting, type the replacement text in the Replace with box. Click Find, Find All, Replace, or Replace All.

Find & Replace Specific Text & Formatting

  • To search for specific text with specific formatting (for example, the word hello in bold), specify the formatting, type 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.
  • Click Find, Find All, Replace, or Replace All.


Tip.png 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 option 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.

Repeat steps 2 and 3 for each style that you want to replace.

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.

Table 1 shows a few of the regular expressions used by OOo.

Tip.png The online help describes many more regular expressions and their uses.


Documentation note.png One of the most common mistakes when using regular expressions is to try to search for a character that is defined as a wildcard, such as brackets or dots. If you need to search for such a character, type a backslash (\) before it. This instructs OOo to treat the character following the backslash as a normal character. For example, to find the text $5.00 ($ and . are wildcard characters), you would conduct a search using \$5\.00.

To use wildcards and regular expressions when searching and replacing:

  1. On the Find & Replace dialog box, click More Options to see more choices. On this expanded dialog box, select the Regular expressions option.
  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).
Expanded Find & Replace dialog box.

Table 1. Examples of search wildcards (regular expressions)

To find Use this expression Examples and comments
Any single character . b.d finds bad, bud, bid, and bed.
Characters at the beginning of a paragraph ^chars ^term
Characters at the end of a paragraph chars$ term.$
One of the specified characters [xyz] b[iu]n finds bin and bun.
Any single character in this range [x-y] [r-t]eed finds reed, seed, and teed; ranges must be in alphabetically ascending order.
Any single character except the characters inside the brackets [^x] p[^a]st finds post and pest, but not past.
The beginning of a word \<start \<log finds logbook and logistics, but not catalog.
The end of a word end\> log\> finds catalog, but not logistics.
A paragraph marker $ Does not work as a replacement character. Use \n instead.
An empty paragraph ^$
An tab character \t
A line break \n Finds a line break that was inserted with Shift+Enter. When used as a replacement character, it inserts a paragraph marker.


Content on this page is licensed under the Creative Common Attribution 3.0 license (CC-BY).
Personal tools
In other languages