Please Note: This article is written for users of the following Microsoft Word versions: 97, 2000, 2002, and 2003. If you are using a later version (Word 2007 or later), this tip may not work for you. For a version of this tip written specifically for later versions of Word, click here: Replacing Two Tabs with a Space in Limited Situations.

Replacing Two Tabs with a Space in Limited Situations

by Allen Wyatt
(last updated October 9, 2017)


Terry often imports information, such as customer names, into Word from a different program. The problem is that the names are in the format (John^t^tDoe), where the first and last names are separated by two tabs and the entire name is surround by parentheses. Terry needs to replace the two tabs with a single space. He knows he could use a regular Find and Replace to do it, but it would affect all other instances of two tabs in the document. He wonders if there is a way to search for the parentheses, a word, and two tabs and replace it with the parentheses, the word, and a single space.

This can actually be done using the regular Find and Replace feature of Word. First, if the names are all within a single portion of your document, you could select the paragraphs that contain the names and do a simple Find and Replace to change the two tab characters to a single space. This would limit the replacements to just what you selected and avoid making changes in other parts of the document where there may be double tab characters used in a different context.

If this cannot be done (perhaps the names aren't limited to a single area of the document), then you can still use Find and Replace. All you need to do is do what is called a wild card search, which opens up the real power being Find and Replace. Follow these steps:

  1. Press Ctrl+H. Word displays the Replace tab of the Find and Replace dialog box.
  2. Click the More button, if it is visible. (See Figure 1.)
  3. Figure 1. The Replace tab of the Find and Replace dialog box.

  4. Select the Use Wildcards check box.
  5. In the Find What box, enter this: (\([A-Z][a-z]{1,})(^t^t)([A-Z][a-z]{1,}\))
  6. In the Replace With box, enter this: \1 \3
  7. Click Replace All.

The key to understanding what is happening with these steps is understanding the search pattern created in step 4. It is easiest to break it down into parts, with each part surrounded (in the pattern) by parentheses. The first part is this:


This part says "find any opening parenthesis, indicated by \(, followed by a single uppercase letter, indicated by [A-Z], followed by at least one lowercase letter, indicated by [a-z]{1,}". The purpose of this part of the pattern is to find the first part of the name within parentheses, before the two tab characters. In Terry's original question, this would find the characters "(John".

The next part of the pattern is this:


This part says "find two tab characters". This is fairly self-explanatory. Because this part follows the first part, just discussed, it means that the two tabs must follow the first name, as already mentioned. The third part of the pattern is this:


This part of the pattern is very similar to the first part. It essentially says "find a single uppercase letter, indicated by [A-Z], followed by at least one lowercase letter, indicated by [a-z]{1,}, followed by a closing parenthesis, indicated by \)". Taken all together, the effect of the search pattern is to find the first name, followed by two tab characters, followed by the last name.

Remember that each part of the search pattern is encased within a set of parentheses. This allows each part to be referenced within the "Replace With" pattern in step 5. Thus, whatever matches the search pattern is replaced with what was found in the first part of the search pattern (the first name and leading parenthesis), a single space, and what was found in the third part of the search pattern (the last name and trailing parenthesis). Very powerful, indeed.

You should be aware that you might need to modify what you search for, depending on the characteristics of the names in your document. As shown here, the search works great, provided that the names (first and last) begin with a single uppercase letter and have no other characters in them, such as spaces or periods. If your names aren't structured in this way, you can modify the search pattern to be less restrictive. For example, consider the following search pattern which could be used in step 4:


This finds any number of characters between the opening parenthesis and the tabs and any number of characters between the tabs and the closing parenthesis.

WordTips is your source for cost-effective Microsoft Word training. (Microsoft Word is the most popular word processing software in the world.) This tip (908) applies to Microsoft Word 97, 2000, 2002, and 2003. You can find a version of this tip for the ribbon interface of Word (Word 2007 and later) here: Replacing Two Tabs with a Space in Limited Situations.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...


Changing the Highlighting Color

You can highlight words and phrases in your document, much the same as you can mark printed words and phrases with a ...

Discover More

Animated Menus

Want to get a bit fancy with how the Word interface behaves? You can configure Word so that its menus don't just appear, ...

Discover More

Inserting the Saved Date In a Header or Footer

When preparing a worksheet for printing, you may want to include in the header or footer the last date the workbook was ...

Discover More

Comprehensive VBA Guide Visual Basic for Applications (VBA) is the language used for writing macros in all Office programs. This complete guide shows both professionals and novices how to master VBA in order to customize the entire Office suite for their needs. Check out Mastering VBA for Office 2010 today!

More WordTips (menu)

Context Menus, Spell Checking, and Common Tasks

Automatic Spell Checking can change your menu options.

Discover More

Getting Rid of Fragment Warnings

Word provides a wide variety of tools that ostensibly help make you a better writer. One of those tools is the grammar ...

Discover More

Spell Check Misses Misspelled Words

If you do a spelling check and notice that Word doesn't catch a word that you know is misspelled, it is easy to get ...

Discover More

FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.


If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is 6 + 6?

2014-08-03 21:19:33

Sandy Hathaway

How can I find and replace all "Mcdonald, Mcandrew, mcghee etc with McDonald, McAndrew etc using wildcards? I can write the find part as (Mc)(a-z]{1}) but how do I specify that the replace part should be 12<uppercase>? (Needless to say, <uppercase> doesn't work!)
Thanks for your help!

2012-07-21 16:02:02

Steven Wells

One too many parentheses in my first example of what doesn't work.
That invalid expression should have been:

2012-07-21 15:58:04

Steven Wells

I tried using nested parentheses to include one or more sets of initial uppercase letters so as to find both Donald and McDonald, or JoeBillyBob. But Word does not accept nested parentheses. So, this is no good:

Further, I cannot use a zero-or-more instance wildcard for potentially hyphenated names to find both Smith and Hamilton-Smith because Word does not accept such regular expressions. This is also no good:

Some programming languages do accept this expression.

For these and other complex cases, the less restrictive example in this WordTips column does work.

This Site

Got a version of Word that uses the menu interface (Word 97, Word 2000, Word 2002, or Word 2003)? This site is for you! If you use a later version of Word, visit our WordTips site focusing on the ribbon interface.

Newest Tips

FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.