How to set single- and double-digit values ​​using the Replace feature in Word

March 30, 2022 0 Comments

Anytime Microsoft Word’s Find and Replace task literally exceeds the standard, you may need a wildcard. Susan Harkins will show you how to use these simple devices.

Display notebooks closeup Microsoft Word and Excel app.  Microsoft Office is an office suite of applications created by Microsoft.
Photo: prima91 / Adobe Stock

Most of us have learned how to use the search and replace feature of Microsoft Word because it is very easy and helpful. However, sometimes a task is complicated enough to send us back to the drawing board. For example, you may think that it is impossible to replace only one or two numbers, but that is not the case. Thanks to a few wildcards, you can do this in just one run. In this article, I will show you a wildcard string that will find all the numbers with only one or two numbers.

See: Software Installation Policy (TechRepublic)

I’m using Microsoft 365 on a Windows 10 64-bit system, but you can use an earlier version. I recommend that you stop upgrading to Windows 11 until all issues are resolved. For your convenience, you can download the Exhibit .docx file. However, this is a simple list of one-, two- and three-digit numbers that you can easily create.

Replacement string

Let’s keep the Replace string simple. Specifically, let’s add text at the beginning and end of each number. Doing so lets us see where things work and what doesn’t. We will work with a simple set of numbers, as shown Figure A. Simple lists include single-, double- and three-digit numbers.

Figure A

We will use this list of simple numbers in Word to examine multiple find strings.

We want to ignore any number consisting of more than two numbers. To that end, we will work with the following replacement string:

Pre ^ and sub

If Word finds the number 03, then this Replace string will return pre03sub.

How to find numeric numbers

To replace or change the existing numeric values ​​of only one or two numbers, you need a wildcard. You might consider simplifying the task by performing two different replacement tasks: one that finds only single-digit numbers and one that finds only double-digit numbers. Fortunately, you can easily combine both searches.

The first wildcard element we will try [0-9]Which finds any number.

Now, let’s work through the first Find string:

  1. On the Home tab, click the Edit option and click Replace. Or press Ctrl + h.
  2. In the resulting dialog, enter [0-9] Find What as a string.
  3. Enter Pre ^ and sub As replacement with string.
  4. Click more if necessary.
  5. Check out the Use Wildcard option Figure B.
  6. Click OK to replace all and then close the data prompt.

Figure B

Click Use Wildcard in Word.
Click Use Wildcard in Word.

As you can see Figure C, This replacement task adds a replace with string to each number, not to each number. This means we need a wildcard that matches a single Words. In this case, the word number is included. If you are working with a display file, be sure to press Ctrl + Z to undo changes made by running Replace before moving on to the next wildcard instance.

Figure C

A little work needs to be done for the word find string.
A little work needs to be done for the word find string.

Fortunately, there is a wildcard that can handle this special search requirement: <>. By fence [0-9] <> A string in letters, Word will interpret the combined numbers as complete words. Let’s <> add characters and try again.

  1. Press Ctrl + H
  2. The replacement feature remembers the last task, so you don’t have to insert strings from scratch. Instead, < এবং > Insert characters, as shown Figure D.
  3. Replace All and click OK.

As you can see Figure D, We’re a little closer. The word ignores three-digit numbers, but it also ignores double-digit numbers. Before you proceed, be sure to press Ctrl + Z to undo the changes

Figure D

The word ignores more numbers than numbers.
The word ignores multiple digits.

We need a way to specify double-digit numbers when ignoring numbers greater than two. That’s where the next wildcard comes in: {. This wildcard specifies any sequence of numbers you specify. {1, find single-digit numbers; {1,2 will find only single- and double-digit numbers. Let’s add it to our existing Find What string and see what happens:

  1. Press Ctrl + H
  2. Tick ​​the কার 1,2} wildcard component at the end of the Find key string, as shown Figure e.
  3. Replace All and then press OK.

Figure e

Finally, the Find What string works.
Finally, the Find What string works.

Success! Find out what string meets each requirement. Let’s take a look at the wildcards we’ve used and how they work

A quick review of Wildcard in Word

Take a minute to review what each wildcard does:

  • [0-9] Specifies all numbers. If used [0-3]Words can only find numbers from 0 to 3.
  • Single search is limited Words. Later, <[0-9]> Multiple-digit numbers will not be considered as bundles of individual numbers.
  • } Lets you specify a sequence of numbers; {1,2 Find numbers that consist of only one or two numbers.

Combining these three wildcards, <[0-9]{1,2}> You will only find numeric values ​​that consist of one or two numbers. If you know how wildcards work, it’s easy to come up with this string so you can only do one replacement job.

Leave a Reply

Your email address will not be published.