Wildcard Secrets Revisited

A few weeks ago I sent out an article called "Three Wildcard Secrets." I thought they were pretty good secrets, too! You can see them here.

In a nutshell, here are the first two:

The wildcard range [A-z], meant to find any uppercase or lowercase letter, will not find accented letters. You have to use [A-Za-z] instead. So I suggested using [!A-z] (not A-z) to find any characters that are accented.

Similarly, if you need to find any unspecified Unicode character, you can use the not range [!^000-^255]. That should work, as 255 is the upper limit on ANSI characters, so anything the range finds must be Unicode.

Then I received a corrective email from macro expert Paul Beverley. The nerve! Here's what Paul had to say about secret #1:

You see the problem? It did what you asked, not what you wanted. It finds any character at all, except A-z.

And Paul is right! The range [!A-z] finds not just accented characters but also spaces, punctuation, and other stuff that isn't letters—something I knew if I'd actually thought about it. You can solve the problem by adding more things that you want to skip. Here's an example:

[!A-z 0-9.,;:\-\?\!^001-^064]

(For more information, see my Wildcard Cookbook for Microsoft Word.)

Next, Paul had this to say about secret #2:

On my PC [!^000-^255] throws up an error:

Now technically, I was right about the range being [!^000-^255]. The problem is that Microsoft Word wants [!^001-^255] instead. And to make things even worse, that wildcard range correctly skips the ASCII characters (numbered 0-126) but incorrectly finds the extended ASCII characters (numbered 127-255), even though we've told it not to. Microsoft strikes again!

But wait, there's more!

  • The range [!^128-^255] gives us the same error message as [!^000-^255].
  • The range [!^127-^255] finds Unicode characters (which it should) and extended ASCII characters (which it should not).
  • The range [!^127-^254] skips extended ASCII characters (which it should) and Unicode characters (which it should not).

All of this weirdness seems to hinge on the points where ASCII becomes extended ASCII, and extended ASCII ends.

Might any of this be useful in your editing work? Yes, if you're using wildcard searches:

  • Use the range [!^127-^255] to find Unicode and extended ASCII characters.
  • Use the range [!^127-^254] to skip Unicode and extended ASCII characters.

That should work, at least until Microsoft decides to fix these problems.

Many thanks to Paul Beverley for his valuable feedback. If you'd like a bunch of free editing macros with instructions on how to use them, you'll want to download Paul's book Macros for Editors.

Three Wildcard Secrets

So, you’ve been using wildcards with Microsoft Word’s Find and Replace feature to save time and ensure consistency as you edit the plethora of freelance work that’s bombarding your inbox. Excellent. But even if you’re getting pretty good at using wildcards, there are actually a few secrets that even many experts don’t know. Maybe you’ll find them useful.

Secret #1

Using the wildcard range [A-z] to find any uppercase or lowercase letter will not find accented letters. Take, for example, the word résumé. [A-z] will find the r, s, u, and m in that word, but it will skip over the two occurrences of é. Go ahead, try it. I’ll be here when you get back.

If you actually want to skip over accented letters, [A-z] might come in handy sometime, but that will rarely be the case. To find all letters, both accented and unaccented, use the wildcard range [A-Za-z] instead. Also, as you might expect, [A-Z] finds both accented and unaccented capital letters, and [a-z] finds both accented and unaccented lowercase letters.

Okay, so [A-z] skips over accented characters; that suggests the idea that we could use a variation on that range to find only accented characters. How? Add an exclamation mark at the beginning of the range, which tells Word to find any character except what is in the range. The modified range looks like this: [!A-z]. Again, using the word résumé, [!A-z] finds the two occurrences of é but skips over r, s, u, and m. If you need to find accented characters, now you know how.

Secret #2

In a wildcard search, you can’t search for Unicode characters using numeric codes (such as ^u945), but you can copy Unicode characters from a document and paste them into Word’s Find box. You can even search for a range of Unicode characters. For example, the range [?-?] from the Greek alphabet (lowercase alpha through omega) finds every character in the Greek greeting ???? ???. You can see the range of characters in various languages by clicking Word’s Insert tab and then the Symbol button on the ribbon:

For example, here, in order, are some of the Cyrillic characters available in Word:

If you need to find any (unspecified) Unicode character in a document, you can use this not range:

[!^000-^255]

That works because 127 is the upper limit on ASCII characters and 255 is the upper limit on ANSI characters. This wildcard string excludes them both, so anything it finds must be Unicode.

Secret #3

You can use the search code ^p to search for paragraph breaks in a regular search, but not with wildcards. If you try, Word will display an error message:

So how do you search for paragraph breaks when using wildcards? Instead of ^p, use ^013. All well and good, but here’s the real secret: In Word’s Replace box, you must not use ^013; instead, use ^p. That’s right:

Find what: ^013

Replace with: ^p

Why? Because Word’s paragraph breaks are not the same thing as an ANSI paragraph break (^013). Word stores all kinds of stuff in paragraph breaks (formatting, for example), and an ANSI break is just a character like any other. I’ve occasionally had to work on documents that came from who-knows-where, and my usual wildcard searches wouldn’t work. I finally realized that those documents were using ANSI paragraph breaks rather than Word’s proprietary paragraph breaks. The solution? Once again:

Find what: ^013

Replace with: ^p

After I replaced the ANSI breaks, my wildcard searches worked again.

Bonus Secret

Microsoft Word’s wildcard search engine uses a modified version of what is widely known as RegEx—short for “regular expressions.” RegEx is more powerful than Word’s version of it, but if you’re feeling geeky, you can actually use RegEx in Word—not in Word’s Find and Replace dialogs but in a macro. If you’re interested, you can learn more here:

http://www.regular-expressions.info/vb.html

I hope you find these wildcard secrets useful. If you’re just getting started with wildcards, please check out my in-depth book on the subject, Wildcard Cookbook for Microsoft Word (ISBN 978-1-4341-0398-7), available at Amazon, Barnes & Noble, and other purveyors of fine technical literature.

Wildcard Cookbook for Microsoft Word

Wildcard Cookbook for Microsoft Word

If you're editing or writing in Microsoft Word, you need to understand Word’s advanced search features. These features are extremely powerful, but they’re also virtually undocumented; most explanations of their use have been limited to a simple table of wildcards. My new book, Wildcard Cookbook for Microsoft Word, explains in detail how you can use these powerful tools to blaze through repetitive problems that would take hours to correct by hand. It covers:

  • Using Word’s find and replace options (yes, all of them—including the hidden ones).
  • Finding and replacing with Word’s built-in codes (for dashes, page breaks, and much more).
  • Finding and replacing with numeric character codes (ASCII, ANSI, and Unicode—when regular letters and numbers aren't enough).
  • Finding and replacing with wildcards, including wildcard ranges, wildcard groups, and the powerful “Find What Expression” wildcard. (This is the good stuff, the real meat of this book.)

The book explains all aspects of finding and replacing in Microsoft Word, with numerous examples of wildcards used to fix real-world documents, wildcard tips and techniques from readers of Editorium Update newsletter, a reference section for ease of use, and a thorough index.

Although I write and sell Microsoft Word macros for a living, the tools I depend on most are Word's advanced find and replace features. Learning to use these tools takes time and effort, but the payoff is huge. I hope this book will help you use these tools to streamline your work, save time, and make more money!

Daniel Heuman, CEO and founder of Intelligent Editing, sent me the following unsolicited comment:

This. Is. Amazing. What a brilliant, brilliant idea! I've actually been directing people to your wildcard freebie page lately. But this is so much better! The world has needed this book for a while!

Thank you, Daniel! The book is now available at Barnes & Noble, Amazon, and other online retailers.


Resources

Wildcard Cookbook for Microsoft Word is a fairly small (but value-packed) book (114 pages, 5.5 by 8.5 inches). My big book, Microsoft Word for Publishing Professionals (632 pages, 7 by 10 inches) is now available as a free download from Intelligent Editing. All you need to do is sign up for Daniel Heuman's free newsletter, which covers a wide range of topics and provides free tips for authors and editors. I subscribe, and I think you should too. When you do, you'll get Microsoft Word for Publishing Professionals as a hyperlinked, searchable PDF, perfect for easy reference in handling those tough Microsoft Word problems.

Note: The PDF includes a secret special offer right after the front cover. I won't tell you what it is; you'll need to find out for yourself. But I think you'll like it!