Word Wildcard Error Messages, Translated
You've built a string. You're rather proud of it, smiling even as you type. You press Find Next, and Word tells you there's a Pattern Match expression that's not valid. Your face falls, and a very slight panic begins to set in…
Word wildcard error messages are technically accurate and almost entirely unhelpful. Each one covers several unrelated problems, and none tells you where in the string to look. Here's what each error is actually complaining about.
“Not a valid character”
Something is in a field where it isn't allowed.
By a wide margin, the most common cause is using ^p in the Find What field. Paragraph marks are the one special character whose code differs between the two fields: use ^13 to find one and ^p to replace one. Everybody makes this mistake, usually more than once.
If that isn't it, you've probably just mistyped something.
“Pattern Match expression not valid”
This wins prizes for imprecision. Often, it means your parentheses are out of whack. Work through the following:
Have you referred to a group that does not exist? Groups are numbered from left to right in the order they appear. If your Find What field has only one pair of parentheses but you use \2, Word has no second group to match.
Have you used more than nine sets? Nine is the limit. If you genuinely have ten, some parentheses probably aren't meant to be expression groups. Check whether those literal parentheses need a backslash.
Have you nested one expression inside another? Something like (x(y)z) isn't allowed. Close each expression before opening the next.
Have you opened one and not closed it, or closed one you never opened? More often, the problem is a literal parenthesis that hasn't been escaped.
Are you searching for literal parentheses? Escape both: \(\). If you escape only the opening parenthesis and leave the closing one unescaped, Word reads the closing parenthesis as wildcard syntax and may reject the pattern.
The same error can appear with braces, for different reasons:
Braces attached to nothing. They specify how many times the preceding character or expression must appear, so something valid has to come before them.
An unclosed pair. Easy to do, easy to miss.
{0,} for “zero or more.” The instinct is sound, but Word doesn’t allow a minimum of zero. Use {1,} for one or more repetitions.
An incomplete pair. {}, {,}, and {,4} are invalid. You can give a minimum without a maximum, but not a maximum without a minimum. Nobody knows why.
“Group number out of range”
This is the Replace With equivalent: you've used \2 when the Find What field contains only one parenthesized group (or none).
The error may not be where you think. It's more common to have left out parentheses in Find What than to have added an extra group reference in Replace With. Check Find What first.
“Pattern Match expression too complex”
Despite the name, this one is about square brackets, not expressions. It means you've used more than seven sets, which is Word's hard limit.
There's no negotiating. Something has to go, which usually means being less specific where the context already protects you, or splitting the job into two searches.
“Range not valid”
This one is about square brackets too. Despite the word “range,” it does not have to involve a hyphen.
Start with the obvious: are all the square brackets paired? They often sit next to braces and parentheses, and in that thicket it is easy to miss one.
Then check the four characters that keep their wildcard powers inside square brackets: the exclamation mark (!), the hyphen (-), the caret (^), and the backslash (\). To search for them literally, escape them: [\!], [\-], [\^], or [\\].
When the exclamation mark comes first inside square brackets, it means “anything except.” So [!abc] is valid and excludes a, b, and c. To find a literal exclamation mark, escape it: [\!].
“No results found”
Not an error, technically. Just disappointing.
Before assuming the string is wrong, check the boring things. Is Use wildcards still ticked? It's easy to knock off. Are you searching the whole document, or has something left you inside a selection? If you're testing a replacement, is Track Changes on?
Then check the case. Every wildcard search is case-sensitive, with no way to turn that off. The string [a-z] will not find a capital letter, and a string that works beautifully in one sentence may find nothing in another simply because a word sits at the start of it.
After that, take the string apart. If it is syntactically valid but finds nothing, test the components separately. Remove part of the string and see whether the rest finds anything; keep narrowing it down until you find the part that fails. It is crude, but it works faster than staring at the whole thing, head in hands.
A better habit than debugging
Most of these problems are easier to avoid by building strings in pieces. Write the first component and run Find to confirm it does what you expect. Add the next component and run Find again. It feels slower, but it is dramatically faster: when something breaks, you know exactly what broke it.
Keep a scratch document for this. It can be about any subject and ideally has 50,000 words or more. A string that behaves itself across a document that size is less likely to surprise you, but still check its matches in the live file.
Get the full guide, free
Brave New Word is our free ebook on Wildcard Find & Replace in Word and PerfectIt, by our in-house linguist Chris Ryder. It covers the complete symbol set, dozens of worked examples across medical, legal, technical, proposal, and academic writing, a full chapter on limitations and pitfalls, this troubleshooting material in more depth, and two chapters on building wildcard checks into PerfectIt so a string you've perfected once can run automatically across future documents. There's also a printable cheat sheet at the back.