Writer:查找和替换文本和格式

出自OOo 中文指南手册翻译

跳转到: 导航, 搜索

目录

在一篇3000字的文章中寻找特定的词语,手动查找是很不够用的。Writer的查找和替换功能,能够在文档内自动进行文本搜索。 When looking for certain words in a 3000-word essay, it is inefficient to go through every word manually. Writer has a Find and Replace feature that automates the process of searching for text inside a document. (1)

除了查找和替换单词和短语,您可以: In addition to finding and replacing words and phrases, you can: (2)

  • 使用通配符和正则表达式细微调整查找。 Use wildcards and regular expressions to fine-tune a search. (3)
  • 查找和替换特定的格式。 Find and replace specific formatting. (4)
  • 查找和替换段落样式。 Find and replace paragraph styles. (5)

要显示查找和替换对话框,使用键盘快捷键 Ctrl + F组合键,或选择编辑 > 查找和替换To display the Find & Replace dialog box, use the keyboard shortcut Control+F or select Edit > Find & Replace. (6)

  1. 查找内容框中键入您要查找的文本。 Type the text you want to find in the Search for box. (7)
  2. 要将其替换为不同的文字,请在替换为框中输入新的文本。 To replace the text with different text, type the new text in the Replace with box. (8)
  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.) (9)
  4. 当您设置好您的查找后,点击查找。要替换文本,则点击替换 When you have set up your search, click Find. To replace text, click Replace instead. (10)
查找和替换对话框 The Find & Replace dialog box(11)
Image:Tip.png如果您点击查找全部,Writer选择文档中所有与搜索文本匹配的例子。同样,如果您点击全部替换,Writer替换所有匹配的文本。
  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.


Image: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 not discovered in time to undo.


[编辑] 使用通配符(正则表达式) Use wildcards (regular expressions) (14)

通配符(也称为正则表达式)是一些字符的组合,告诉OOo如何查找一些内容。正则表达式是非常强大的,但不是很直观。它们可以将多个查找组合成为一个,从而节省时间和精力。 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. (15)

表1显示了OOo使用的一些正则表达式。 Table 1 shows a few of the regular expressions used by OOo. (16)

Image:Tip.png联机帮助介绍了更多的正则表达式及其用途。
  The online help describes many more regular expressions and their uses.


Image:documentation_note.png使用正则表达式最常见的错误之一,就是试图查找一个定义为通配符的字符,如方括号或点号。如果您需要查找这样的字符,在该字符之前键入一个反斜杠(\)。这样就告诉OOo将反斜杠后面的字符,作为一个正常的字符处理。例如,要查找文本$5.00($ 和 . 都是通配符),你要使用\$5\.00进行查找。
  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: (19)

  1. 在查找和替换对话框中,单击更多选项,看到更多的选择。在扩展的对话框中,选择正则表达式选项。 On the Find & Replace dialog box, click More Options to see more choices. On this expanded dialog box, select the Regular expressions option. (20)
  2. 查找内容框中键入要查找的文本,包括通配符;在替换为框中键入要替换的文本(如果有的话)。并非所有的正则表达式都可以用作替换字符,换行符(\n)是其中可以替换的一个例子。 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. (21)
  3. 点击查找查找全部替换全部替换(不推荐)。 Click Find, Find All, Replace, or Replace All (not recommended). (22)
扩展的查找和替换对话框. Expanded Find & Replace dialog box.(23)

表1. 通配符(正则表达式)查找的例子 Table 1. Examples of search wildcards (regular expressions) (24)

若要查找 To find (26) 使用这个表达式 Use this expression (27) 实例和注解 Examples and comments (28)
任何单个字符 Any single character (30) . b.d 查找 bad, bud, bid, and bed.
在段落开头的字符 Characters at the beginning of a paragraph (34) ^chars ^term
在段落结尾的字符 Characters at the end of a paragraph (38) chars$ term.$
指定的字符之一 One of the specified characters (42) [xyz] b[iu]n 查找 bin and bun.
在指定范围内的任何单个字符 Any single character in this range (46) [x-y] [r-t]eed 查找 reed, seed, and teed; 范围必须按字母升序排列.
除括号内字符外的任何单个字符 Any single character except the characters inside the brackets (50) [^x] p[^a]st 查找 post and pest, 但是不包括 past.
一个单词的词首 The beginning of a word (54) \<start \<log 查找 logbooklogistics, 但是不包括 catalog.
在一个单词的词尾 The end of a word (58) end\> log\> 查找 catalog, 但是不包括 logistics.
段落标记 A paragraph marker (62) $ 不能作为替换字符。使用\n代替。 Does not work as a replacement character. Use \n instead. (64)
空白段落 An empty paragraph (66) ^$
一个制表符 An tab character (69) \t
一个换行符 A line break (72) \n 查找一个用Shift + Enter插入的换行符。当用作替换字符时,它插入一个段落标记。 Finds a line break that was inserted with Shift+Enter. When used as a replacement character, it inserts a paragraph marker. (74)

[编辑] 查找和替换特定格式 Find and replace specific formatting (76)

查找和替换的一个非常强大之处就是具有使用格式选项的优势。例如,您可以将下划线字体替换为斜体字。 A very powerful use of Find & Replace takes advantage of the format option. For example, you might want to replace underlined words with italics. (77)

在查找和替换对话框中点击更多选项后显示: On the Find & Replace dialog box with More Options displayed: (78)

  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. (79)
  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. (80)
  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. (81)
  4. 点击查找查找全部替换全部替换 Click Find, Find All, Replace, or Replace All. (82)
Image: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 (84)

如果你把来自多个来源的材料组合在一起,您可能会发现,突然在您的文档中显示了许多不需要的段落样式。要快速将所有段落的一个(不需要)样式改变为另一个(希望使用的)样式: 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: (85)

  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. (86)
  2. 选择您要查找和替换的样式。 Select the styles you want to search for and replace. (87)
  3. 点击查找查找全部替换全部替换 Click Find, Find All, Replace, or Replace All. (88)

[编辑] 相关链接

本文原文

个人工具