word替换使用通配符_在Word 中搜索时如何使用通配符

时间:2024-05-18 19:07:47
word替换使用通配符_在Word 2016中搜索时如何使用通配符

word替换使用通配符

word替换使用通配符_在Word 2016中搜索时如何使用通配符

Word has a powerful search feature that lets you search for text, numbers, formats, paragraphs, page breaks, wildcards, field codes, and more. By using wildcards, you can search for just about everything in your document. Let’s take a look.

Word具有强大的搜索功能,可让您搜索文本,数字,格式,段落,分页符,通配符,域代码等。 通过使用通配符,您可以搜索文档中几乎所有内容。 让我们来看看。

如何使用通配符进行高级搜索 (How to Use Wildcards for Advanced Searching)

Switch over to the “Home” tab on Word’s Ribbon, and then click the “Replace” button.

切换到Word功能区上的“主页”选项卡,然后单击“替换”按钮。

word替换使用通配符_在Word 2016中搜索时如何使用通配符

In the Find and Replace window, click “More” to expand the dialog box and view additional options. If you see a “Less” button instead, you’re ready to roll.

在“查找和替换”窗口中,单击“更多”以展开对话框并查看其他选项。 如果您看到“ Less”按钮,那么您就可以滚动了。

word替换使用通配符_在Word 2016中搜索时如何使用通配符

With the window expanded to show search options, enable the “Use Wildcards” checkbox.

随着窗口展开以显示搜索选项,请启用“使用通配符”复选框。

word替换使用通配符_在Word 2016中搜索时如何使用通配符

Notice that when you enable the “Use Wildcards” option, Word shows that the option is enabled right under the “Find what” edit box. Also, when the “Use wildcards” check box is selected, Word finds only the exact text that you specify. The “Match Case,” “Find Whole Words Only,” “Match Prefix,” and “Match Suffix” checkboxes are unavailable.

请注意,当您启用“使用通配符”选项时,Word会在“查找内容”编辑框正下方显示该选项已启用。 同样,当选中“使用通配符”复选框时,Word仅查找您指定的确切文本。 “匹配大小写”,“仅查找整个单词”,“匹配前缀”和“匹配后缀”复选框不可用。

word替换使用通配符_在Word 2016中搜索时如何使用通配符

Next, click “Special” to view the wildcard list.

接下来,单击“特殊”以查看通配符列表。

word替换使用通配符_在Word 2016中搜索时如何使用通配符

Finally, select a wildcard character to insert it into your search criteria. After selecting a wildcard, the character is added to your search box. You can also enter the character using your keyboard instead of choosing it from the wildcard list. The “Special” menu provides a reference in case you don’t remember the special characters available to you and their meaning.

最后,选择一个通配符以将其插入搜索条件。 选择通配符后,该字符将添加到您的搜索框中。 您也可以使用键盘输入字符,而不是从通配符列表中选择字符。 “特殊”菜单提供了参考,以防您不记得可用的特殊字符及其含义。

Ready to see how wildcards work? Let’s take a look at some specific examples.

准备看通配符如何工作? 让我们看一些具体的例子。

您可以将通配符用作什么? (What Can You Use Wildcard Characters For?)

That “Special” menu contains a lot of special characters you can use to search a Word document, but they don’t all qualify as wildcards. Most of them are for finding specific, and sometimes hidden, Word characters like spaces, hyphens, and em dashes.

该“特殊”菜单包含许多特殊字符,您可以使用它们来搜索Word文档,但它们并不全都可以用作通配符。 它们中的大多数用于查找特定的(有时是隐藏的)Word字符,例如空格,连字符和破折号。

Here, we’re going to focus specifically on wildcards that are used to either stand in for one or more characters of text or modify a search based on another character in your search.

在这里,我们将重点专门放在通配符上,通配符用于代表一个或多个文本字符,或者基于搜索中的另一个字符修改搜索。

使用星号指定任意数量的字符 (Use an Asterisk to Specify Any Number of Characters)

The wildcard you’re likely to use most frequently is the asterisk. It indicates that you want to search for any number of characters. For example, to search for all words beginning with “Th,” type “Th*” in the “Find What” box, and then click the “Find Next” button. That asterisk stands in for any number of letters following the “Th” in this example.

您最常使用的通配符是星号。 它表示您要搜索任意数量的字符。 例如,要搜索以“ Th”开头的所有单词,请在“查找内容”框中键入“ Th *”,然后单击“查找下一个”按钮。 在此示例中,星号表示“ Th”之后的任意数量的字母。

word替换使用通配符_在Word 2016中搜索时如何使用通配符

As an alternative to typing an asterisk character using your keyboard, you can use the select the special character from the wildcard list. First, type “Th” in the Find what box, then click the “Special” button. Next, select “0 or More Characters” from the wildcard list and then click “Find Next.”

作为使用键盘输入星号字符的替代方法,您可以使用从通配符列表中选择特殊字符。 首先,在“查找内容”框中键入“ Th”,然后单击“特殊”按钮。 接下来,从通配符列表中选择“ 0个或更多字符”,然后单击“查找下一个”。

word替换使用通配符_在Word 2016中搜索时如何使用通配符

Word evaluates the search and shows you the first occurrence it finds in the document. Keep clicking “Find Next” to find each part of the text that matches your search term.

Word对搜索进行评估,并向您显示它在文档中首次发现的内容。 继续单击“查找下一个”以查找与您的搜索词匹配的文本的每个部分。

word替换使用通配符_在Word 2016中搜索时如何使用通配符

One thing to keep in mind is that searching is case sensitive when you have wildcards turned on. So searching for “Th*” vs. “th*” will produce different results.

要记住的一件事是,当您启用通配符时,搜索区分大小写。 因此,搜索“ Th *”与“ th *”将产生不同的结果。

使用问号查找特定数量的字符 (Use a Question Mark to Find A Specific Number of Characters)

While the asterisk stands in for any number of characters, the question mark wildcard works much the same way but stands in for only a single character. So, using “th*” finds all words starting with “th” using “th?” instead only finds words that start with “th” and have only one additional character.

星号代表任意数量的字符,而问号通配符的工作方式几乎相同,但仅代表单个字符。 因此,使用“ th *”查找使用“ th?”以“ th”开头的所有单词而是仅查找以“ th”开头且仅具有一个附加字符的单词。

And just like with the asterisk, you can use a question mark anywhere in a word. For example, searching for “d?g” will find all three letter words beginning with “d” and ending with “g,” such as “dig,” “dug,” and “dog.”

就像星号一样,您可以在单词的任何地方使用问号。 例如,搜索“ d?g”将找到所有以“ d”开头并以“ g”结尾的三个字母词,例如“ dig”,“ dug”和“ dog”。

word替换使用通配符_在Word 2016中搜索时如何使用通配符

You can also use multiple question marks together to stand in for multiple letters. For example, searching for “d??g” will find all four letter words starting with “d” and ending with “g”, such as “doug” and “dang.”

您还可以一起使用多个问号来代表多个字母。 例如,搜索“ d ?? g”将找到所有以“ d”开头并以“ g”结尾的四个字母词,例如“ doug”和“ dang”。

word替换使用通配符_在Word 2016中搜索时如何使用通配符

You can even use them in different places in your search phrase. For example, searching for “d?n?” would find four letter words where the first letter is “d” and the third letter is “n,” such as “dang” and “ding.”

您甚至可以在搜索短语的不同位置使用它们。 例如,搜索“ d?n?” 会找到四个字母词,其中第一个字母为“ d”,第三个字母为“ n”,例如“ dang”和“ ding”。

word替换使用通配符_在Word 2016中搜索时如何使用通配符

使用At符号(@)和花括号({和})查找上一个字符的出现 (Use the At Sign (@) and Curly Brackets ({ and}) to Find Occurrences of the Previous Character)

You can use the at sign (@) to specify one or more occurrences of the previous character. For example, searching for “[email protected]” would find all words that begin with “ro” and end with “t” and that have any number of the letter “o” following that first occurrence. So, the search would find words like “rot,” “root,” and even “roooooot.”

您可以使用at符号(@)指定一个或多个出现的前一个字符。 例如,搜索“ ro @ t”将找到所有以“ ro”开头,以“ t”结尾并且在首次出现之后具有任意数量的字母“ o”的单词。 因此,搜索将找到“ rot”,“ root”甚至“ roooooot”之类的词。

word替换使用通配符_在Word 2016中搜索时如何使用通配符

For even more control over finding previous characters, you can use curly brackets to specify the exact number of occurrences of the previous character you want to find. For example, searching for “ro{2}t” would find “root” but not “rot” or “roooooot.”

为了更好地控制查找先前的字符,可以使用大括号指定要查找的先前字符的确切出现次数。 例如,搜索“ ro {2} t”将找到“ root”,但找不到“ rot”或“ roooooot”。

word替换使用通配符_在Word 2016中搜索时如何使用通配符

使用尖括号(<和>)标记单词的开头和结尾 (Use Angled Brackets (< and >) to Mark the Beginning and End of a Word)

You can use angled brackets (lesser than and greater than symbols) to mark the beginning and end of words for a search. For example, you could search for “<but>” and Word would find all instances of the word “but” but not words like “butterfly” or “halibut.”

您可以使用尖括号(小于和大于符号)标记要搜索的单词的开头和结尾。 例如,您可以搜索“ <but>”,Word会找到单词“ but”的所有实例,但找不到“ butterfly”或“ halibut”之类的单词。

word替换使用通配符_在Word 2016中搜索时如何使用通配符

That’s useful enough, but this technique becomes more powerful when you combine it with other wildcards. For example, just using the asterisk when searching for something like “t?sk” would find words like “task” and “tusk” as well as results where that search string was just a part of other words like “tasking” or “multitasker.”

这足够有用,但是当您将其与其他通配符结合使用时,此技术将变得更加强大。 例如,在搜索“ t?sk”之类的单词时仅使用星号会发现“ task”和“ tusk”之类的单词,以及搜索字符串只是“ tasking”或“ multitasker”等其他单词的一部分的结果。”

But if you were to mark the beginning and end of a word in a search like “<t*sk >” the results would include “task” and “tusk” but not the others.

但是,如果要在“ <t * sk>”之类的搜索中标记单词的开头和结尾,结果将包括“任务”和“象牙”,但不包括其他。

word替换使用通配符_在Word 2016中搜索时如何使用通配符

You don’t even have to use both the angled brackets as a pair. You can just mark the beginning or end of a word by only using the appropriate bracket. For example, searching for “<t*sk” would find words like “task,” “tusk,” and “tasking” but not words like “multitask.”

您甚至不必将两个尖括号都成对使用。 您可以仅使用适当的括号来标记单词的开头或结尾。 例如,搜索“ <t * sk”将找到诸如“任务”,“象牙”和“任务”之类的单词,但找不到诸如“多任务”之类的单词。

使用方括号([和])查找特定字符或字符范围 (Use Square Brackets ([ and]) Find Specific Characters or Character Ranges)

You can use the square brackets to specify any character or range of characters. For example, searching for “[a]” would find any occurrence of the letter “a.”

您可以使用方括号指定任何字符或字符范围。 例如,搜索“ [a]”将发现字母“ a”的任何出现。

Where this comes in handy, though, is with searching for any of a number of characters. For example, searching for “b[aeiou]t” would find text that started with “b” and ended with “t” but had any vowel as the middle letter—so it would find “bat,” “bet,” “bit,” “bot,” and “but.”

不过,方便查找的地方是搜索许多字符。 例如,搜索“ b [aeiout””将找到以“ b”开头,以“ t”结尾但以任何元音作为中间字母的文本,因此它将找到“ bat”,“ bet”,“ bit” ,“机器人”和“但是”。

word替换使用通配符_在Word 2016中搜索时如何使用通配符

You can also use square brackets to find a range of characters. For example, searching for “[a-z]” would find any of those lower case letters. Searching for “[0-9]” would find any of those numbers.

您也可以使用方括号查找一系列字符。 例如,搜索“ [az]”将找到这些小写字母中的任何一个。 搜索“ [0-9]”将找到任何这些数字。

使用括号将搜索词分组为序列 (Use Parentheses to Group Search Terms into Sequences)

You can use parentheses in your search to group strings of characters, and they’re usually used when performing a find and replace operation. One of the most common examples of this would be if you needed to reverse names in your document—say from first-name-last to first-name-first.

您可以在搜索中使用括号对字符串进行分组,并且通常在执行查找和替换操作时使用它们。 最常见的示例之一是,如果您需要将文档中的名称反转(例如从名后到名至名)。

Here’s an example. We’d like to change all instances in our document of “Griggs Amelia” to “Amelia Griggs.” We type those search terms into our “Find What” box, and then we group them using parentheses so that the last name and first name are in separate groups.

这是一个例子。 我们希望将“ Griggs Amelia”文档中的所有实例更改为“ Amelia Griggs”。 我们在“查找内容”框中键入这些搜索词,然后使用括号将它们分组,以使姓氏和名字位于不同的组中。

word替换使用通配符_在Word 2016中搜索时如何使用通配符

Word automatically numbers those groups from left to right (behind the scenes), so in the “Replace With” box, we can call those groups by number using a preceding backslash. Here, for example, in our “Replace With” box we’re using the text “\2 \1” and that tells Word to replace what it finds by placing the second grouping (the name Amelia) in the first position and the first grouping (the name Griggs) in the second position.

Word自动从左到右(在幕后)为这些组编号,因此在“替换为”框中,我们可以使用前面的反斜杠按编号来调用这些组。 例如,在这里,在“替换为”框中,我们使用文本“ \ 2 \ 1”,它告诉Word通过将第二个分组(名称为Amelia)放在第一个位置和第一个位置来替换它找到的内容。在第二个位置分组(名称为Griggs)。

word替换使用通配符_在Word 2016中搜索时如何使用通配符

如果需要搜索也是通配符的字符,请使用反斜杠(\) (Use a Backslash (\) if You Need to Search for a Character That’s Also a Wildcard)

So, what if you need to search for a character in your document that also happens to be a wildcard. For example, what if you need to find everywhere you used an asterisk?

因此,如果您需要在文档中搜索恰好也是通配符的字符,该怎么办。 例如,如果您需要查找所有使用星号的地方怎么办?

Well, one thing you could do is turn off the “Use Wildcards” option before performing your search. But if you don’t want to do that, you can also use a forward slash (“/”) in front of the character. For example, to find a question mark while “Use Wildcards” is turned on, enter “/?” in the “Find what” edit box.

好吧,您可以做的一件事是在执行搜索之前关闭“使用通配符”选项。 但是,如果您不想这样做,也可以在字符前面使用正斜杠(“ /”)。 例如,要在打开“使用通配符”时查找问号,请输入“ /?” 在“查找内容”编辑框中。

word替换使用通配符_在Word 2016中搜索时如何使用通配符


You can get pretty sophisticated by combining wildcards in your Word searches in different ways, so experiment with things. We’d only recommend not doing big search and replace operations all at once unless you’re sure you’ve used your wildcard correctly or you’re working on a test copy of your document.

通过在Word搜索中以不同方式组合通配符,您会变得非常复杂,因此请尝试一下。 除非您确定已正确使用通配符或正在处理文档的测试副本,否则我们建议您不要一次全部执行大搜索和替换操作。

翻译自: https://www.howtogeek.com/362551/how-to-use-wildcards-when-searching-in-word-2016/

word替换使用通配符