Tag Archives: find-and-replace


I hate getting a toruntila. It’s like wanting an Oreo and getting an Oregardingo, like ordering a sausage and getting a saCanadage. The disappointment cannot be overprovinciald: you have been the victim of a reckless replacement; the filling you expected is not there and instead you have something… out of place and perhaps weirdly starchy. You look at your plate, wave over the waiter, and say “I’m not leaving till I get a tortilla” – but even as you speak your words are changed to “I’m not leaving until I get a toruntila.” Oh, the hupersonity!

Yes, toruntila may look like tarantula, but while it can be hairy and can have a nasty bite, it’s really what a tortilla becomes when someone decides that till needs to be replaced with until throughout the document (by the way, while preferring until to till is defensible as a matter of taste, till is by no means an error – in fact, until was originally formed from till, not the other way around). And, more broadly, just as a mondegreen is a misheard lyric (often containing a nonexistent word – classiomatic is an automatic classic of the type), and a Cupertino is an erroneous spellchecker replacement (because Word ’97 would suggest Cupertino in place of cooperation), a toruntila is a reckless-replacement sandwich.

Say, for instance, you tell your find-and-replace to change “re” to “regarding” throughout, and you neglect to check “Whole Word Only”; say you tell it to replace “USA” with “Canada” and neglect to uncheck “Ignore Case”; or say you equally recklessly replace “state” with “provincial” or “man” with “person” (or with “human”)… there you are with your Oregardingo and saCanadage and underprovinciald and hupersonity (or huhumanity). And if you run a second reckless replacement to make son into child, you may get huperchildity, which is a second-level toruntila.

Do you doubt that these things happen? Editors know that they do. But why take my word for it? You can easily Google toruntila and see for yourself. It’s not a word that exists in this world for any other reason than the reckless replacement, and every context you see it in clearly needs tortilla instead. As Jonathon Owen has pointed out on finding this particular gaffe in several books, “It takes multiple independent screw-ups to make something like this happen.” And yet happen it does. (And more easily on websites that have less rigorous editorial processes.)

So now you have a word for it. Every disuntilery, every unforreceivetable or forbecoming, every discomRobertulation, every denaTorinog, every schildmark, every dash of cardamother or kernel of fathercorn… they are all toruntilas, with an unexpected filling that leaves a bad taste in your mouth.

A walk on the wildcard side

In my experience, most editors – let alone less proficient users of Word – have little to no familiarity with Word’s wild cards and are afraid to try them. This is a pity: It’s like being afraid to learn how to copy and paste instead of retyping every time. Using wildcards is not hard, and it can save you a lot of time.

Do you need to memorize a whole bunch of rules? No. This isn’t a course where you will have a closed-book test at the end. Whenever you can’t think of what to do, the Microsoft Word MVP Site has a lovely resource at word.mvps.org/faqs/general/UsingWildcards.htm . You can just look there and refresh your memory. But I’ll save you a little time and effort with a rundown of the basic principles, followed by some useful examples.

Basic principle 1: Know your superheroes

There are a few symbols that, when you have “Use wildcards” checked under Find and Replace, become something magical and highly powerful:

  • *: The asterisk can represent any number of whatever characters. If you search w*rd you will find word, weird, walked backward, and even phrases such as what! To do 7 isn’t hard – anything that starts with a w and ends with rd and doesn’t have another w or rd in between. Also wrd, because * can stand for nothing at all.
  • ?: The question mark represents one character of any type. Search l??t and you will find lent, last, l33t, etc., but not lit or least.
  • @: The at-sign represents a repeat of the previous character zero or more times. If you search ah@ you will find ah, ahh, ahhh, etc.

Basic principle 2: Be more specific

Much of the time, you don’t actually want to use such high-powered ammunition. You may not be able to specify an exact word – if you could, you probably wouldn’t need wild cards – but you can limit it to a smaller set of characters. There are four tools you need for this:

  • <>: The angle brackets indicate the start and end of a word. So <*> is a word of any length, <?> is a one-letter word, and so on. You don’t have to use them together: ?> will find the last letter of any word.
  • []: Square brackets let you search for any one of a specified set of characters. If you want to find mad, bad, sad, or dad, you can search [bdms]ad. If you want to find a semicolon or colon, use [;:]. If you want any of a range of characters, you can use a hyphen to indicate the range: [0-9] means any numeral; [A-Z] means any capital letter; [a-z] any small letter; [A-z] any letter at all; [0-9A-z] will find any numeral or letter.
  • !: The exclamation mark means “not!” So if you want an occurrence of a letter other than lowercase p or q, for instance, use [!pq]. And if you want to find all words that are not capitalized, you can use <[!A-Z]*>.
  • {}: If you want more than one occurrence of the type of character just specified, you can specify how many using curly brackets. [0-9]{2} will find any two numerals: 29, 47, 68, etc. You can indicate minimum and maximum numbers of occurrences with a comma: [A-Z]{1,3} will find anything with one to three capital letters in a row; [0-9]{2,} will find any set of two or more numerals in a row (no upper limit). To find all capitalized words four or more letters long, use <[A-Z][a-z]{3,}> (if you don’t use the <>, you will also find the Phone in iPhone, for instance).

Basic principle 3: Divide and number

You are very likely to want to break down what you’re searching for into two or more parts, so you can change, move, or remove one part and not another. The way to do this is to use parentheses in your search term and backslash numbers in your replace term.

For instance, let’s say you have 99039 J Wilkins, 85042 K Palmer, etc., and you want it to be Wilkins: 99039, Palmer: 85042, and so on.

So you start with three parts: The number, the initial, and the last name. They are, respectively, [0-9]{5}, [A-Z], and <[A-Z][a-z]{1,}> – plus the spaces, don’t forget that there are spaces between the words. We can use parentheses to divide it into the following parts: ([0-9]{5})( [A-Z] )(<[A-Z][a-z]{1,}>).

We now have parts 1, 2, and 3. And that is how Word will know them – to be precise, as \1, \2, and \3. In your replacement, you are putting the third one first, then a colon and space, then the first one third – in other words, \3: \1. That’s it!

Basic principle number 4: Backslash your way out of conflicts

What if you want to find one of the special characters above as itself? What if you’re looking for parentheses, for instance? Just use a backslash before the character: \( and \) for the parentheses, \@ for the at-sign, and so on.

Now here are three examples of ways wildcard find-and-replaces can make your life easier.

Example 1: Putting en-dashes in number ranges

You want to change hyphens to en-dashes between numbers? You just need to find any number, hyphen, any number, and change it to the same but with a dash in place of a hyphen:

Find: ([0-9])(-)([0-9]) Note that you don’t have to backslash the hyphen – it only has special meaning inside square brackets.

Replace: \1–\3

Be careful, though – if you have phone numbers in your document, you will need to avoid them or change them back.

Example 2: Converting US-style large numbers to metric-style

How about if you need to change numbers such as 4,231 to 4231, but numbers such as 67,853 to 67 853? First change the 5- or 6-digit numbers (because the 4-digit numbers also occur inside the 5- and 6-digit ones):

Find: ([0-9]{2,3})(,)([0-9]{3})

Replace: \1 \3

Then change the four-digit numbers:

Find: ([0-9])(,)([0-9]{3})

Replace: \1\3

But beware: if you have numbers over a million, they will be affected by this, so you’ll have to deal with them first.

Example 3: Formatting titles in a bibliography

Let’s say your bibliography entries are like this:

Garfield TC. The mechanisms of purring. Journal of Feline Biomechanics 23:7 (1998): 12–45.

And you want them to be like this:

Garfield TC. “The mechanisms of purring.” Journal of Feline Biomechanics 23:7 (1998): 12–45.

Because you can’t apply formatting to just part of the result, you need a multi-step process. First add the quotes and some markers for where the italics will start and stop (I’ll use | and §, assuming those are used nowhere else in the text to be dealt with). Turn off the automatic smart quotes – Word may curl them the wrong way.

Find: ([A-Z]. )([A-Z]*.)( )([A-Z]*)( [0-9])

Replace: \1"\2"\3|\4§\5

Then let’s italicize the title:

Find: (|)(*)(§)

Replace: \2 Specify format as italic

Then you need to turn on autocorrect to smart quotes and find and replace all the quotes (find " and replace with " and it will curl them all for you). Et voilà: like magic!

Fun with find & replace: trailing punctuation

A colleague found herself faced with a formatting problem: the book she was working on required trailing punctuation (commas, periods) to match the formatting of the word they trailed (bold, italic). This can be hard to spot, and tedious to do by hand. She was working in MS Word. Was there a way to do it in find-and-replace using wild cards?

The answer is yes, and it involves one of my favourite F&R subterfuges, the dummy character.

It’s a bit of a nuisance that Word can specify formatting only over a whole search term, not part of one. But dummy characters help get around that:

1. Replace all bold whole words with the same word plus a special character used nowhere else in the document (a per-thousand sign or a pilcrow or a double dagger or whatever, but it has to be used nowhere else).

The find field will look like this: (<*>)
It will have “Use Wildcards” and “Font: Bold” specified for it.
The < and > mean start and end of word; the * means any number of characters; the ( and ) define it as a single term.

The replace field will be like this if your special character is ξ:  \1ξ
(Replace ξ with whatever character you use.)
The \1 refers to the first (and in this case only) defined term from the Find field.

2. Search all instances of that character followed by a comma or a period (or whatever trailing punctuation you want to change – but only one at a time) and change them to bold.

This is just changing ξ. (or whatever special character and whatever trailing punctuation) to bold, no wild cards needed (make sure to remove the format specification on the Find field). In fact, don’t use wild cards; . is a special character in wild cards (you’d need to make it \.).

3. Delete all instances of the special character.

In other words, find ξ (or whatever your character is) and replace it with nothing – completely empty cell, not even a space. Make sure to remove all formatting specifications.

4. Do the same but with italic rather than bold formatting.

The bolding and italicization should be done as separate steps. Reduces possible confusions, and also handles bold italics neatly.

This can also be used for preceding punctuation, e.g., opening quotes. The variation is trivial and is left as an exercise to the reader. 🙂

Well Begun Is Nearly Done: Desktop publishing workflow at warp speed

Presented at the 32nd annual Editors’ Association of Canada conference, Vancouver, May 29, 2011

It’s a long time ago, in a galaxy far, far away. The three humans, two droids, and one wookiee on the Millennium Falcon are being attacked by Imperial cruisers. They can escape by jumping into hyperspace. But the pilot, Han Solo, is taking time getting coordinates from the navi-computer. As laser blasts hit, Luke Skywalker shouts, “Are you kidding? At the rate they’re gaining…”

And Solo replies, “Traveling through hyperspace isn’t like dusting crops, boy! Without precise calculations we could fly right through a star or bounce too close to a supernova and that’d end your trip real quick, wouldn’t it?”


It’s this week, in an office all too close to home. A project is on a tight deadline. You have the workflow and the people lined up, but you’re taking time making sure that everything is set up the right way in the layout… and the source file… As the telephone is ringing off its hook, your project manager shouts, “Are you kidding? We don’t have time for niceties like that! Just make it happen!”

And you reply, “Desktop publishing isn’t like using a typewriter. Without setting it up the right way, we could get nailed and waste hours redoing everything when the client wants to change some element of the look late in the game. And you know they will. And that would take us way over time and budget, wouldn’t it?”


You’ve probably heard your mother or teacher or some similar person say, “Well begun is half done.”

Well, when it comes to desktop publishing, well begun is really a lot more than half done. Continue reading