How to Find Anything in Parentheses Using Word’s Search
Print This

- Image via Wikipedia
I recently ran into a strange problem. I was asked to present an academic paper at a conference, and while writing fell automatically into the habit of referencing all my quotes and other citations with traditional parenthetical citations. When I went to produce the shorter copy that I would read from at the conference, I wanted to remove all those parenthetical citations — they were just clutter and I Knew I’d stumble over them while I read.
Here’s the thing: normally, I could just use the “wildcard” to search for anything inside of parentheses, like this: (*). The problem is, when you enable wildcards in Word’s search, you also enable a bunch of operators, and parentheses are among them — Word uses parentheses to group together different parts fo the search query, the same way you use them in math, e.g. 12*4+3 vs. 12*(4+3). So a search for (*) simply returned everything.
Here’s how I solved the problem:
- With wildcards disabled, I did a “find and replace”, replacing all left-parentheses “(” with an ampersand “&”.
- Then I replaced all the right-parentheses “)” with a dollar sign “$”.
- With the parentheses all turned into something unique (if I’d used dollar signs or ampersands in the paper, I’d have replaced the parentheses with carets or percent signs or any other punctuation or symbol I hadn’t used) I could enable “Use Wildcards” and search for the phrase “&*$” (without quotes).
- Because there might well be other statements in parentheses, I used “Find next” and “Replace” rather than “Replace all” to go through the paper and delete only the citations.
- Finally, I restored the parentheses by running the above find-and-replace operations backwards, turning dollar signs and ampersands back into their respective parentheses.
And that’s it. It wasn’t particularly intuitive, unless you’re deeply familiar with how wildcards work in Word, but once I grasped that the parentheses were the problem, it was a simple matter to replace them and blast them out of my paper.
And the presentation went well, though of course I found plenty of other things to stumble over, like words and my tongue…

Don't miss a single post. Grab the RSS feed!



May 19th, 2009 at 2:57 pm
Hi Dustin,
Depending on what version of Word you’re using, you could do this another (simpler) way. Since Word is recognizing the open brackets as part of its search expression, you need to type them in with a backslash: \(.
To find parentheticals, try using this expression:
\([^\)]*\)
I don’t have Word installed right now, but that should work. If not, try surrounding it with square brackets.
Later,
Adriano
May 20th, 2009 at 5:38 pm
Adriano’s way confused me, though I suppose it would work. Yours, on the other, Dustin, made perfect sense. Nice fix.
May 21st, 2009 at 6:26 am
I like the way you think Dustin.
I have used similar methods, as I use different versions of MS Word, OpenOffice.org Writer, and older word processing software that can utilize “find and replace” functions, but use different expressions.
Substituting a character or group of characters that do not otherwise appear in the document and then deleting them is much easier, at least for me, than figuring out what expression to use with what software.
I also use “Find next” and “Replace” rather than “Replace all”, so that I know exactly what is being replaced.
August 30th, 2009 at 10:35 am
You should probably write a macro to do the replacing and searching. But I would rather use some other software instead of Word, for example, LyX or Emacs
November 22nd, 2009 at 7:46 pm
Hey, thanks….I was about to write a simple Java program to accomplish the task before finding your advice.