How to insert space characters into the middle of a string using Replace in Word

Microsoft Phrase’s Change characteristic is under-used as a result of the extra complicated the requirement, the extra complicated the answer. Should you’re inserting characters into the center of a string, there’s a answer.

man typing on computer

Picture: istock/BongkarnThanyakij

Some Microsoft Phrase customers by no means progress past the only find-and-replace duties as a result of they do not know about wildcards or they discover them tough to use. I admit that generally the answer stays a thriller to me till I go away the pc to run the vacuum or carry out another menial process, which appears to clear my thoughts so the reply can rise to the floor. 

SEE: 83 Excel ideas each person ought to grasp (TechRepublic)

Realizing how the wildcards work is not sufficient; you have to pay attention to how the 2 search strings, discover and exchange, relate to at least one one other. On this article, I am going to present you a exchange process that makes use of wildcards to insert an area in the course of three characters. How they relate to one another is important to succeed. 

I am utilizing Microsoft 365 on a Home windows 10 64-bit system, however you should utilize earlier variations. Phrase On-line would not assist wildcards. For you comfort, you may obtain the demonstration .docx and .doc information, however the search strings are easy, and you may simply create the doc your self by referring to Determine A

The issue

Let’s suppose you may have a number of strings the place the one relationship is that the primary two characters are all the time the identical—let’s use a and b. What follows ab will usually be completely different: abc, ab8, abf and so forth. The characters following the primary two are inconsistent in kind however the strings will all the time be three characters, as proven in Determine A. You wish to retain all the characters however insert an area after b, in each occasion.

Determine A


  Let’s insert an area after b, in each occasion the place ab is the primary two characters in a three-letter string.

In Excel, you would possibly attempt a string operate and even Textual content to Columns, however these options aren’t accessible in Phrase. Your first inclination might be Change, and that is the place I might begin. 

Except you are very acquainted with this characteristic, you would possibly attempt a couple of issues that will not work comparable to ab?, which works OK for locating the primary three characters in strings that start with ab, however how do you keep the ? character within the exchange string? Should you attempt ab ?, you may discover that it would not work as anticipated! It returns, ab ?; it would not retain the precise third character within the string. You would possibly attempt a number of completely different units of find-and-replace strings that just about get you there. The reply is a couple of wildcards and might be simpler than you would possibly suppose.

SEE: Home windows 10: Lists of vocal instructions for speech recognition and dictation (free PDF) (TechRepublic)

The way to use the wildcards in Phrase

As hinted at, wildcards are the reply, however getting simply the appropriate ones in each the find-and-replace search strings takes a little bit of thought (except you are a wildcard knowledgeable). Let’s break it down by every wildcard character.

First, the ? character will discover any single character, so ab? does what you anticipate. The issue is, you may’t simply categorical the alternative string, not as is. That answer is to outline a spread utilizing the () characters so Change is aware of which character to repeat to the alternative string, after inserting the area:


This will get us nearer as a result of the vary (?) is referred to within the exchange string by place. On this case, it is the primary place, so you find yourself with

discover: ab(?)

exchange: ab 1

The exchange string features a area between ab and 1, however what does 1 imply? That is a reference to the area (?) within the discover string. Merely put, the character references a spread and the #1 tells Phrase which vary. On this case, there’s just one. Phrase copies the character in parentheses to the alternative string. These two get us nearly there, so let’s run them and see what occurs:

  1. Press Ctrl + H to open the Change dialog.
  2. Delete any earlier find-and-replace strings.
  3. Within the Discover What management, enter ab(?).
  4. Within the Change With management, enter ab 1. Keep in mind that there is a area between ab and 1.
  5. If needed, click on the Extra button after which examine the Use Wildcards possibility and the No Formatting possibility if it is not dimmed (to take away formatting utilized within the earlier exchange process).
  6. Click on Change All (Determine B).  
  7. Shut the dialog.

Determine B


  The discover string matched the string ‘about.’

As you may see in Determine B, the find-and-replace strings labored completely till they encountered the phrase ‘about.’ That is as a result of the (?) part does match a single character, but it surely would not match just one character as a result of it is a part of a spread. Consequently, it would not scale back the discover string to solely three characters.

The excellent news is that we really are nearly there. Earlier than persevering with, press Ctrl + Z to undo all of the adjustments the earlier exchange process made. Then, repeat the directions above, skipping step 2—you do not wish to delete what you have already got. In step 3, enter > to the top of the string: ab(?)>. The > character denotes the top of the search. Including this character will pressure Phrase to cease matching with the third character.

As you may see in Determine C, the search works as anticipated, altering the primary three strings and leaving the phrase “about” intact. 

Determine C


This time the 2 strings work collectively to return the anticipated outcomes. 

Are you questioning why Phrase ignores ABC, Inc.? Checking the Use Wildcards possibility takes care of that string robotically as a result of wildcard searches are case delicate.

We used only some wildcards—(), ?, and —to get the job executed. Realizing what wildcards do and the way they work collectively is vital to success. 

Additionally see

Recent Articles


Related Stories

Leave A Reply

Please enter your comment!
Please enter your name here

Stay on op - Ge the daily news in your inbox