Abdu-Sahib has a document containing multiple sets of parentheses containing numbers in the form ( #/# ). He needs to remove the spaces within the parens and around the numbers. Abdu-Sahib is sure this can be done with a wild card Find and Replace, but he needs help understanding the proper form.
Abdu-Sahib is correct—this can be done using a wild card Find and Replace, but that may not be necessary. If you don't mind doing two passes in a regular Find and Replace, you could first search for a left parenthesis followed by a space and replace it with a left parenthesis. This will remove the extra spaces at the beginning of what Abdu-Sahib is seeing. Then, in the second pass, search for a space followed by a right parenthesis and replace it with a right parenthesis. The two passes will remove the spaces, as desired.
The only time this wouldn't work is if there are valid spaces after or before left and right parentheses elsewhere in your document. In that case, you would need to do a wild card search. Here is the pattern you would use in the Find What box:
\([ ]*([0-9]{1,}/[0-9]{1,})[ ]*\)
The key thing here is the use of backslashes before the opening paren and the closing paren. These let Word know that you want to match an actual opening or closing parenthesis; without the backslash, Word uses the parentheses for grouping what is matched, as discussed in a moment.
After the opening paren (preceded by the backslash) there is a bracketed space followed by an asterisk:
[ ]*
This means "zero or more spaces." This is used to match any number of spaces (or no spaces at all) after the left parenthesis. This is then followed by the number pattern, in parentheses:
([0-9]{1,}/[0-9]{1,})
This means "one or more digits, followed by a slash, followed by one or more digits." That should handle the number format that Abdu-Sahib indicated. Note that this pattern is enclosed within parentheses, which means it is treated as a group that can be referenced in the Replace With box, as you'll see in a moment.
The final thing within the Find What pattern is another "zero or more spaces" code and the right parenthesis. This closing parenthesis, too, is preceded by a backslash.
In the Replace With box, this is all that needs to be entered:
(\1)
This means you want to replace whatever is found with a left parenthesis, the contents of what is within the first group in the Find What pattern (remember that groups are enclosed in parentheses in the Find What pattern), and a right parenthesis.
The result of this wild card Find and Replace is that the leading and trailing spaces in the format that Abdu-Sahib specified are removed.
There is one other thing that should be mentioned. If the numbers on both sides of the slashes could contain other characters, such as a period, comma, or minus sign, then you need to modify your Find What pattern a bit. In that case, you would use a pattern like this:
\([ ]*([0-9,.-]{1,}/[0-9,.-]{1,})[ ]*\)
The only difference here is the inclusion of those extra characters within the brackets on both sides of the slash.
WordTips is your source for cost-effective Microsoft Word training. (Microsoft Word is the most popular word processing software in the world.) This tip (13689) applies to Microsoft Word 2007, 2010, 2013, 2016, 2019, 2021, 2024, and Word in Microsoft 365.
The First and Last Word on Word! Bestselling For Dummies author Dan Gookin puts his usual fun and friendly candor back to work to show you how to navigate Word 2019. Spend more time working and less time trying to figure it all out! Check out Word 2019 For Dummies today!
In plain-text documents, it is not uncommon to see asterisks used around text to indicate what should be considered bold ...
Discover MoreIf you get a document or some text that has multiple consecutive spaces used to align information, you'll undoubtedly be ...
Discover MoreThe Find and Replace capabilities of Word are very powerful, allowing you to accomplish more than one task at a time. ...
Discover MoreFREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."
There are currently no comments for this tip. (Be the first to leave your comment—just use the simple form above!)
Got a version of Word that uses the ribbon interface (Word 2007 or later)? This site is for you! If you use an earlier version of Word, visit our WordTips site focusing on the menu interface.
Visit the WordTips channel on YouTube
FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."
Copyright © 2026 Sharon Parq Associates, Inc.
Comments