Using find and replace to check a document
Find and replace in Microsoft Word as of 2014 checks a document as well as changing it. Its special codes and wildcards find spacing, punctuation, decimal commas, units cut off from their values and abbreviations throughout a document, its advanced search finds text by its format or style, and its wildcards turn an unformatted table from a statistical program into a Word table.
Checking as well as replacing
As of 2014, find and replace can be used for checking and not only for simple searching and replacing, yet one trainer in Word often finds that course participants' attention has never been drawn to this. A writer who digs deeper into the function is likely to make much greater use of it, because it eases some of the thankless tasks of writing and editing. The main thing to remember is to think hard before pressing Replace all, and it is almost always better to replace items one at a time.
Checks built from the Special list
In Word as of 2014, a button marked Special at the bottom of the dialog lists some of the special things that can be searched for and replaced. Spaces, punctuation, strings and codes can all be searched for in the Find what field, with entries such as any character, any digit and any letter. The list is longer for the Find what field than for the Replace with field, because the elements that can be replaced are limited.
Checks that can be run from the Find what and Replace with fields as of 2014 include the following.
- One space or two after a full stop. In text from different authors who have used one or two spaces after a full stop, a check that every full stop is followed by one space searches for any letter, a full stop, two spaces and any letter, with the number of spaces adjusted to the number sought. Each hit is reached with Find next and one space is deleted by hand, because automatic replacement does not work with the any-letter code. The string can be typed instead of chosen from the Special list, and the search works with either the Find or the Replace tab active.
- A comma used as a decimal point. In texts from Continental European authors, the search is for any digit, a comma and any digit. The replacement is again made by hand, but every instance is found.
- A space left before punctuation. Where tracked changes left the text so messy that spaces before commas could not be seen, the search is for a space followed by a comma and the replacement is a comma. The same is done for opening and closing brackets, semicolons and full stops.
- A unit separated from its value. To keep a unit with its value across an automatic line break, the search is for a space followed by the unit, such as mg, and the replacement is a non-breaking space followed by the unit. The search also catches every unit that starts with the same letters, such as mg/dl. One trainer in Word prefers to replace these one at a time, or to type the non-breaking space during writing.
- A paragraph mark at the end of every line. Text copied into Word from a PDF, an email or another unformatted source can carry a paragraph mark at the end of each line with no space before it. Replacing each paragraph mark with a space removes them but leaves some double spaces, and depending on the length of the text, replacing two spaces with one can then remove those. Replace all can probably be used for the first step, because text in that state is likely to be heavily edited anyway.
The list of checks that can be built from the Special entries is endless, and exploring them lets a writer cut some corners and save time.
As of 2014, Word's own online help for find and replace is worth printing out, because it offers a wide range of ways of finding and checking other things, and trying them shows which functions need the Find tab active and which the Replace tab.
Format and wildcard searches
The three uses that follow apply to Word 2010 for Windows, and as of 2014 similar options are available in other recent versions of the program.
The first use finds text by its characteristics. Holding Ctrl+F, choosing Advanced Find from the drop-down list beside the search box and clicking More gives a Format option under Find, which searches for particular fonts, including bold, italic, colour or point size, for highlighted text, or for text that has been given a particular style. The Special button there includes options for finding only paragraph marks, digits or letters.
The second use makes the spaces between sentences uniform. Ctrl+H opens find and replace, Use wildcards is selected under More, and wildcards have a simple syntax. In a document with one, two or even three spaces between sentences, a space typed in the find box and followed by {1,3} looks for at least one space and at most three, and a single space typed in the replace box removes the excess spaces. With Use wildcards selected, the Special button helps with the syntax.
The third use brings an unformatted table from a statistical program into Word. The repeating headers and footers are deleted so that the table is continuous, with the first header and the last set of footers left in place. Wildcards then find a range of spaces and convert it to a tab, and the range has to be chosen carefully, perhaps 5 to 100, because each tab becomes a column. Convert Text to Table, in the Table group on the Insert tab, then builds the table with tabs as the delimiter.
Abbreviations highlighted with wildcards
As of 2014, a wildcard search highlights every abbreviation in capital letters that has at least two letters. In Word 2003, the string [A-Z]{2} is entered in the Find what field under the Find tab, Use wildcards and the option to highlight all items found in the main document are selected, and Find all is clicked. In Word 2007, the same string is entered in the Find what field under the Find tab with Use wildcards selected, and Highlight All is chosen under Reading highlight. The search works only with the Find tab active. In Word 2003 the highlighting colour can be changed and the document printed with the abbreviations marked. In Word 2007 they have to be reviewed on screen, and as of 2014 one trainer in Word had found no way of printing the highlighting and did not know whether it is possible. The result is nowhere near an automatic list of abbreviations, but it is a great help in a document of more than a few tens of pages.