Word 2003 – The Find What text contains a Pattern Match expression which is not valid.
May 2, 2006
Today I was trying to clean up a Word document and I had a lot of items that were in the following format:
{Number:Number:Number}
So for example– {1:25:89} or {6:12:1}.
At first I was just doing a search for a left curly brace, then I would take my cursor, highlight all of the offending text and hit delete. It didn't take long before I determined that was going to be too tedious.
Luckily, I noticed in the Find and Replace dialog, if I hit More>>> there was a Use wildcards option. So I did a search on:
{%:%:%}
But I got an error:
The Find What text contains a Pattern Match expression which is not valid.
"Whoops," I thought and assumed it was ADO getting the best of me. ADO's wildcard character is %. So I revised my search:
{*:*:*}
Still, I was greeted with the same error. The same with questions marks as my wildcard character and the same with just searching on {.
It turns out, Word's wildcard search is pretty much a regular expression search (it does appear to be missing some support like \d, \w, etc). And just like regular expressions, Word uses the curly braces to define repeating patterns. As a result my search was using a reserved character. In the end, I just had to escape the braces with a backslash:
\{*:*:*\}
From there, I left the Replace with field blank and was able to use the Replace All button to purge all those items in one swoop. Even with the initial confusion, it was well worth it!
Here's another article detailing some common search scenarios and their syntax:
http://www.bcentral.co.uk/technology/software/microsoft-word-search-replace-find-tutorial-clipboard.mspx
Entry Filed under: Pattern Match expression, Word 2003. .
8 Comments Add your own
Leave a Comment
Some HTML allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>
Trackback this post | Subscribe to the comments via RSS Feed






1.
ClintJCL | May 4, 2006 at 9:44 am
Somebody needs regular expressions
2.
ClintJCL | May 4, 2006 at 9:44 am
Regular expressions kick ass. This would be one line in perl.
3.
ClintJCL | May 4, 2006 at 10:05 am
arg, My first comment, which I can’t delete, was posted before I realized I skipped the paragraph where you talk about regex — I tend to read things out of order a lot.
4.
tgaw | May 4, 2006 at 9:28 pm
Heh— that’s okay. I do the same thing!
5.
Clint | May 6, 2006 at 2:31 pm
Yea but at least you don’t start to formulate your rseponse before you finish readnig it. That’s asynchronicity at its worst!
6. MS Word’s Find and &hellip | September 20, 2007 at 10:44 am
[...] just noticed a post on TGAW’s blog, Word 2003 – The Find What text contains a Pattern Match expression which is not valid, which contained some information that I don’t need right this second, but I do want to make [...]
7.
Clint | September 20, 2007 at 12:34 pm
BTW, EditPlus lets you do regex searches and replaces across ALL open files… I’ve dragged 100+ files into it and done this. Easier than sed in my opinon (because I don’t know sed, haha).
8.
George | May 19, 2009 at 2:13 pm
Damn, I had to do the same thing (escape braces).
Thanks a lot!