Word's Advanced Find and Replace...
A Powerful Tool You Should Know How to Use
There are many things you can accomplish quickly in large files when you use the Advanced Find & Replace feature in Microsoft Word.
For instance, suppose you wanted to replace all occurrences of [any_digit]abc with [same_digit]xyz. In other words, suppose you wanted to find 1abc or 2abc or 3abc, ..., or 9abc and replace "abc" with "xyz" keeping the preceding digit. The result you want is for 1abc to become 1xyz and 2abc to become 2xyz and so on through to 9abc becoming 9xyz.
In the Find and Replace dialog, turn on the "Use Wildcards" search option. Click the More button to reveal this option.
Then, using our example the "Find what:" box would contain the following: <([0-9])??? and the "Replace with" box would contain: \1xyz.
Breaking it down on the Find:
- The < character specifies the beginning of the word.
- Next is a left parenthesis and its closing partner is the right parenthesis.
- Within them it is saying this is the first item to evaluate and designate it as "item 1". More on that in a moment...
- In the brackets [ ] are the range of numeric values to allow for the first character in the string.
- Finally, following the right parenthesis, which closes out item 1, is the ??? that represents any three characters.
On the Replace side:
- The \1 command is saying take "item 1" from the Find
- The "xyz" is your replacement string for the ??? on the find.
Sounds a bit cryptic. Trying to explain it is harder than doing it. But try it out and you'll see the result. You can use the wildcard find and replace feature to accomplish many tasks that would otherwise take you a great deal of manual effort, for example:
- Switching the order of names from Richard Michaels to Michaels, Richard
- Making sure every paragraph in your document ended with a period.
- Switching the order of dates from 22 April 2013 to April 22, 2013
- Adding punctuation behind honorifics such as Mr Michaels to Mr. Michaels
These are just a few of the many things you are able to accomplish when you begin to understand and use the Advanced Find & Replace feature of Microsoft Word. For more information on Find and Replace using Wildcards visit Word MVP Graham Mayor's website.