Please Note: This article is written for users of the following Microsoft Word versions: 2007, 2010, 2013, 2016, 2019, 2021, and Word in Microsoft 365. If you are using an earlier version (Word 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Word, click here: Replacing Spaces in Part Numbers with Dashes.
Terry has a document that contains a lot of numeric data. Often, the document has part numbers with spaces in them, such as "422 891A." Terry needs a way to search through the document and find any "digit-space-digit" sequence and replace it with "digit-dash-digit." For instance, "422 891A" would be changed to "422-891A." Terry wonders if there is a way to do this with Find and Replace.
This type of find-and-replace operation can be done quite easily by using the wildcard searching built into Word. Here's the quick version:
That's it. When the Use Wildcards check box is selected (in step 3), Word allows you to use patterns in the search. In this case, each instance of [0-9] means "match any single digit in the range of 0 through 9." The parentheses around each instance is for grouping purposes that allows what is found within that group to be referenced in the Replace With box. So, essentially, the Find What pattern matches any single digit followed by a space followed by any single digit.
What is then entered in the Replace With box is a set of references to what was found. The \1 and \2 indicators mean "what was found in the first set of parentheses and what was found in the second set of parentheses." So, this means "replace the first digit with itself, followed by a dash, then replace the second digit with itself."
Of course, you may need to get even more specific in the pattern you search for, if it is possible that the digit-space-digit pattern may appear in other places in the document and you don't want them affected. In that case, perhaps your part-number pattern consists of three digits followed by a space and then three more digits and then a single alphabetic character, as shown in the example provided at the first of this tip. If that is the case, then you can search for the following in step 4:
([0-9]{3}) ([0-9]{3})([A-Z])
In this case, you'll immediately note the addition of two instances of {3}. These characters are an indicator that there needs to be three of whatever immediately precedes the indicator. Thus, there needs to be three digits, each of 0 through 9. Also, the [A-Z] characters matches a single capital letter in the range of A through Z.
Also note that there are three sets of parentheses in this Find What pattern. These then can be referenced in the Replace With box (step 5), as follows:
\1-\2\3
Since this search is more specific, there is very little chance that you will replace spaces with dashes where you didn't mean to do a replacement.
WordTips is your source for cost-effective Microsoft Word training. (Microsoft Word is the most popular word processing software in the world.) This tip (10835) applies to Microsoft Word 2007, 2010, 2013, 2016, 2019, 2021, and Word in Microsoft 365. You can find a version of this tip for the older menu interface of Word here: Replacing Spaces in Part Numbers with Dashes.
Discover the Power of Microsoft Office This beginner-friendly guide reveals the expert tips and strategies you need to skyrocket your productivity and use Office 365 like a pro. Mastering software like Word, Excel, and PowerPoint is essential to be more efficient and advance your career. Simple lessons guide you through every step, providing the knowledge you need to get started. Check out Microsoft Office 365 For Beginners today!
When you paste something into your document, you expect it to at least be readable. If, instead of letters, you see small ...
Discover MoreTired of pressing the Delete or Backspace key for every character you want to delete? Here's a way you can make your ...
Discover MoreWord provides a couple of different ways you can insert the current date into a document. Which method should you choose? ...
Discover MoreFREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."
2026-08-27 14:04:31
Timothy J. McGowan
@Malcolm Patterson:
Great additions. Thanks for posting that!
2026-08-27 08:38:50
Malcolm Patterson
Note that most part lists use a hyphen--not a dash--in the part numbers. In documents, it's usually a good idea to make these nonbreaking hyphens, inserted as "^-" in the *Replace with:* box. This ensures that the number won't be split between two lines. For the same reason, if the part numbers are supposed to have spaces instead of hyphens or dashes, it's a good idea to replace them with nonbreaking spaces ("^s"). A dash is slightly wider than a hyphen, but if that is what you really want, the en dash is inserted with "^=" (the em dash is "^+" but it's even wider and rarely what you want in a part number).
If you are using a font in which each numeral is the same width, you may want to insert the figure dash, U+2012.
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