MS Word

Change "Firstname Lastname" to "Lastname, Firstname"

Beautiful. Just beautiful. The chairperson just handed me the list of our members' names and askedwell, toldme to change it from "Firstname Lastname Membershipnumber" to "Membershipnumber Tab Lastname, Firstname." My future flashed before me, and it's looking tedious enough to bore a well.

Word can do this for you. Open the document and select the part of it that contains the names. (If the whole document is the names, you don't need to select anything. Otherwise, select only the names, as the pattern matches any sequence of three words.) Choose Edit » Replace (or press Ctrl+H) to display the Replace tab of the Find and Replace dialog box. Clear any formatting from the "Find what" box and the "Replace with" box. Enter (<*>) (<*>) (<*>) in the "Find what" box, with a space between each closing parenthesis and the opening parenthesis following it. Enter \3^t\2, \1 in the "Replace with" box, including the space after the comma. Check the "Use wildcards" box and click the Replace All button. Word changes the position of the words.

Table 3-2. Wildcard characters for searching in Word
WildcardMeaningExample using the wildcard
? Any one character sh?p finds "ship" and "shop".
* A string of characters (including spaces) w*d finds strings of text that start with "w" and end with "d", such as "wad", "wood", "wicked", and part of "stra wberry d onut". This also finds "wd", because the string can have zero length.
< The beginning of a word or group of characters <wear finds "wear", "wearisome", and other words with "wear" at the beginning, but not "swear" or "sportswear".
> The end of a word or group of characters >ble finds "horrible", "terrible", and other words that end in "ble", but not words such as "bleary" or "ablest".
() Group wildcard characters (<*>) finds a word by specifying a group with the start of the word, the * wildcard to find a string of characters, and the end of the word.
[] One or more of the characters specified w[aeu]d finds "wad", "wed", and "weed", but not "wood", because "o" is not included in the bracketed selection of letters.
[a-f] One of the characters in the specified range [l-r]ower finds "lower", "mower", "power", and "rower", but not words such as "tower" or "cower", which are outside the range. You must specify the range in alphabetical order.
[!a-f] Any character except those in the specifie-d range [!l-r]ower finds "bower", "cower", "dower", "tower", and "vower", but not words such as "lower" or "mower", which are inside the range. Again, you must specify the range in alphabetical order.
{n,} n or more instances of the previous character or expression ke{1,}p finds "keep", "kepi", and "kept".
{n,m} From n to m instances of the previous character or expression, where m is 255 or less 5{1,3} finds "5", "55," and "555".
@ One or more instances of the previous character or expression pe@p finds "pep" and "peep".
\wildcard Find the specified wildcard \* finds the * character.

How does this work? You've just used three wildcard characters to build a regular expression. Once you check the "Use wildcards" box in the Find and Replace dialog box, you can use the wildcard characters shown in Table 3-2 to search for items. See the next Annoyance for another example of using wildcards in regular expressions.

You're not going to remember these wildcards, are you? No matter. Check the "Use wildcards" box in the Find and Replace dialog box, and you can click the Special button to display a pop-up menu of the wildcards (see Figure 3-13).

Figure 3-13. Once you've checked the "Use wildcards" box, you can enter wildcards from the Special pop-up menu in the Find and Replace dialog box.