Formatting Issues

How to Replace Six-Digit Numbers with Two-Digit Groups in Word

Kushani NimanthikaKushani Nimanthika Oct 26, 2026 870 views

Question details

The user needs to reformat consecutive six-digit numbers into groups of two separated by spaces using Find and Replace instead of a macro.

How to Replace Six-Digit Numbers with Two-Digit Groups in Word
Product
Word
Device & OS
not provided
Scenario
Formatting specific numeric strings in a document without accidentally altering other numbers like years or dates.
Observed behavior
Numbers currently appear as continuous six-digit strings (e.g., 265223) and need to be separated into two-digit pairs (e.g., 26 52 23).
Before you start

Before making bulk changes across your entire document, highlight a small section of your text to test the wildcard replacement rule and ensure it doesn't accidentally alter unintended numbers.

Solution 1Recommended

Use Advanced Wildcards in Find and Replace

This method safely identifies exact six-digit numbers and groups them into pairs separated by spaces, preventing other numerical values from being modified.

Using regular expressions (wildcards) allows Word to search for exact patterns. By defining word boundaries, we ensure that four-digit years or ten-digit phone numbers are ignored.

1
Open Find and Replace

Press Ctrl + H on your keyboard to open the Find and Replace dialog box in your document.

2
Enable Wildcards

Click the 'More' button to expand the advanced search options, and check the box labeled 'Use wildcards'.

3
Enter Find Pattern

In the 'Find what' box, type (<[0-9]{2})([0-9]{2})([0-9]{2}>) to locate exact 6-digit numbers. The angled brackets act as boundaries.

4
Enter Replace Pattern

In the 'Replace with' box, type \1 \2 \3 to insert a space between each captured pair.

5
Execute Replacement

Click 'Replace All' to update the formatting of the numbers throughout the document.

Use Advanced Wildcards in Find and Replace
Boundary Protection: The < and > symbols ensure that only exact six-digit strings are affected. Shorter or longer numbers in your document will remain untouched.
WPS Writer Solution

Reformat Numbers Easily with WPS Writer

WPS Writer fully supports advanced Find and Replace wildcard operations, allowing you to format complex text and numerical data rapidly without writing macros.

  1. 1. Open Document: Launch WPS Writer and open the document containing the numbers to format.
  2. 2. Open Find and Replace: Press Ctrl + H on your keyboard to launch the Find and Replace utility.
  3. 3. Enable Wildcards: Click the 'Options' button in the dialog box and check the 'Use wildcards' option.
  4. 4. Input Search Parameters: Enter your expression (<[0-9]{2})([0-9]{2})([0-9]{2}>) in the Find field and \1 \2 \3 in the Replace field.
  5. 5. Replace All: Click 'Replace All' to instantly format your six-digit numbers into two-digit groups.
Seamlessly compatible with Microsoft Word document formats (.docx)Full support for advanced wildcard searches and regular expressionsFree, lightweight, and fast word processing applicationFamiliar user interface for immediate productivity
microsoft office alternative - wps office

Frequently Asked Questions

Why is Find and Replace modifying dates or other numbers in my document?

This happens if you do not use word boundaries (the < and > symbols in wildcards). Without boundaries, a 6-digit search pattern will also match and modify the first 6 digits of longer strings, such as a 10-digit phone number.

Can I use macros instead of wildcards to format numbers?

Yes, VBA macros can be written to identify and reformat numbers. However, utilizing wildcard Find and Replace is generally much faster, safer, and doesn't require programming knowledge for standard formatting tasks.

What do the \1 \2 \3 commands mean in the Replace field?

These are known as backreferences. They refer to the grouped items enclosed in parentheses from the 'Find what' field. \1 represents the first group of two digits, \2 the second, and \3 the third group.

Does WPS Office support the same wildcard rules as Microsoft Word?

Yes, WPS Writer supports standard wildcard syntax for Find and Replace. The exact same regular expressions used in Word will work seamlessly in WPS Office.