Word Productivity

Today's Best Tech Deals

Picked by Macworld's Editors

Top Deals On Great Products

Picked by Techconnect's Editors

I love getting maximum efficiency from my Mac, so I love features that let me do a lot with a minimum of effort—features like the Find And Replace dialog box in Microsoft Word X. Many programs have a similar find-and-change tool, but Word’s offers hidden features that can supercharge your productivity if you learn a few special codes. These codes let you search and replace text in ways you may never have thought possible.

Word’s codes are based on regular expressions, which let you use wild cards to describe patterns in text, such as “any uppercase letter followed by any numeral.” Regular expressions are lifesavers when you need to find a word that could be spelled two different ways, or to apply special formatting to anything that looks like a product code or a telephone number.

Word doesn’t support as many regular expressions as Bare Bones Software’s $179 BBEdit and $49 TextWrangler (781/687-0700, www.barebones.com), and computer languages such as Perl, do. But it has one important advantage: most of the text I work with is already in a Word document.

Here’s how you can use a few of Word’s wild-card codes to perform cool find-change actions. (For a helpful code guide, see “Find It Fast.”) To make any of these work, choose Edit: Replace, click on the downward-pointing triangle in the Find And Replace dialog box, and select the Use Wildcards option.

Take the First Steps

The best place to start is with Word’s über -wild card—the asterisk (*), which finds any amount of text. For instance, if you type

in the Find What field, Word finds car, carburetor, and can’t make par.

Let’s say you remember that there’s an epic quote about boats in your 300-page document, but you’re not sure exactly what it said. Instead of finding every instance of the word boat and hunting through the results, you can narrow your search by typing

in the Find field. Word will find only strings of text that start with a quotation mark, include the word boat somewhere, and end with a quotation mark. If your document uses smart quotes (typographic quotation marks), specify them here by using these keystrokes: option-[ (open square bracket) and option-shift-[.

To test your regular expression, switch to the Find tab of the Find And Replace dialog box, turn on the Highlight All Items Found In option, and then click on Find All. You should see at least one match in the document window behind the dialog box.

You can apply formatting to the text you find this way. For instance, perhaps you want to change the font. Switch to the Replace tab, make sure the Replace With field is empty, and choose formatting from the Format pop-up menu at the bottom of the dialog box.

Find a Word

Regular expressions may seem scary because they look like mysterious codes strung together. However, if you break regular expressions into pieces, they’re really not that complicated.

You already know that you can use Word’s regular Find command to find every word that includes the letter q (such as aqua or quince ), but what if you want to search your file for every word that begins with q ( quince, Quark, and so on)? The regular expression for “find every word that begins with the letter q ” looks like this:


Here’s a translation: The open angle bracket (

) means “beginning of word,” so Word knows that the next character we ask for must be the first letter in a word. Square brackets indicate a range of characters, so
means “find either a q (lowercase) or a Q (uppercase). Next,
means the second character of the word could be any uppercase or lowercase letter in the alphabet. (If you typed
, Word would find only lowercase letters; if you typed
, it would find only numerals.) Because you don’t know how long these words are, you have to use the
symbol, which indicates that you want to “find one or more characters of the same type as the previous one.” In this case, it means “find one or more uppercase or lowercase letters.” Finally, the closing angle bracket tells the program that the last character is at the end of the word.

Once you’ve found the words that begin with q, you’ll want to do something with them: for example, put them in quotation marks. In the Replace With field, type

. The
means “insert whatever text the program finds”—in this case, the words that begin with q.

If you need to specify both a first and a last letter for your word, try typing something like

<[wW][! ]s>
in the Find field. You’ll locate all words that begin with the letter w and end with the letter s .

Again, this makes sense if you take it one step at a time. The angle brackets on each end mean that the expression encompasses a single word and that the first character can be either an uppercase or a lowercase w. The exclamation mark means “not,” so

[! ]
translates as “any character that is not a space” (there’s a space after the exclamation mark). So
[! ]@
means “one or more characters in a row that are not spaces.” The
at the end means that the last character of the word must be an s. This expression would find waits, waters, and even gibberish like w3%hU;s.

Rearrange Text

It’s not hard to replace the single phrase Speaker: Howard Phyques with Speaker: Phyques, Howard, but it might get tiresome if you had several hundred names to reformat this way.

Instead, search for

Speaker: (<[A-z]>) (<[A-z]%gt;)
. The phrase
means simply “any word consisting of one or more uppercase or lowercase letters.” So your Find field tells Word to search for Speaker: followed by a space and two words.

Notice that in this example we’ve put each regular expression in parentheses. This lets you use a shorthand to refer to each portion separately in the Replace With field: the

stands in for the first name,
stands in for the last name. Or you can reverse the order and place a comma between the names by typing this into the Replace With field:
Speaker: \\2, \\1

Clean Up Quickly

No problem. First, I search for

. The backslash before each angle bracket tells Word that I’m actually searching for the angle bracket character —I’m not using the angle bracket as regular-expression code.

Next, I put the code (which represents a URL) inside parentheses so that Word sees it as a separate entity. That will allow me to do two things. First, I'll be able to more easily strip out the angle brackets that surround the URLs. Second, I'll be able to use the handy shorthand

to represent the code in the Replace With field. The code itself,
, translates as “a string of one or more characters that are anything except a hyphen or an equal sign.”

For the Love of Wild Text

The human brain is the best pattern-recognition device in the world, but when it comes to editing long documents, regular expressions have us beat. Build a few regular expressions, and you’ll find yourself hooked—and much more productive in your work.

1 2 Page 1
Page 1 of 2
Shop Tech Products at Amazon