When multiple TXT files contain a large number of numbers, serial numbers, or variable keywords, manual search and replacement are very error-prone. This article explains, through a practical example, how to use the "Find and Replace Text" feature in HeSoft Doc Batch Tool to import multiple text files, select the formula-based fuzzy search method, and use the regular expression \d+ to batch match all consecutive numbers, then uniformly replace them with AAA. This method is suitable for text desensitization, content cleaning, data organization, and batch office processing.
Many office document processing tasks seem simple at first glance but turn out to be quite time-consuming in practice. For example, you might receive a folder containing a batch of TXT text files, each with different content but all containing a large number of digits. Now you need to uniformly replace these digits with a certain placeholder to facilitate anonymization, demonstrations, testing, or subsequent formatting. If you only have one file, you can manually find and replace using Notepad, an editor, or other tools; but with dozens of text files, manual processing becomes repetitive labor, and issues like missed replacements, replacing the wrong files, or forgetting to save can easily arise.
This article focuses on the requirement of "using wildcard regular expressions to batch find and replace keywords in many text files," demonstrating how to perform batch operations with the office software " HeSoft Doc Batch Tool ". The example will batch replace all consecutive digits in multiple TXT files with "AAA". You can understand this as a universal method: as long as the search rules are written accurately, you can uniformly process the variable content within a large number of files all at once.
Applicable Scenario: Batch Replacing Variable Keywords in TXT Files
Standard find and replace is suitable for handling fixed keywords, such as replacing all instances of "old name" with "new name". However, in practical office work, much of the content needing replacement isn't fixed. For instance, the same batch of text might contain different digits, statistical values, distances, years, serial numbers, version numbers, monetary amounts, or quantities. Their commonality isn't "identical content," but "similar format." This is when you need to use wildcards or regular expressions to search based on rules.
The rule used in this article is \d+, which can match consecutively appearing digits. Whenever a sequence of digits appears in the text, it will be identified and replaced with the specified content. This method is highly suitable for the following needs:
- Batch replacing digits in TXT documents with placeholders for data anonymization.
- Batch cleaning numerical information from English articles, databases, and log texts.
- Uniformly replacing serial numbers, quantities, or statistical figures across multiple text files.
- Changing variable numerical values to fixed identifiers before content publishing to facilitate proofreading.
- Batch preprocessing of exported txt text, log files, and instruction documents from systems.
HeSoft Doc Batch Tool is a batch file processing software oriented towards office scenarios. It is not an editor for processing single files but instead imports files into a task list and executes rules uniformly. For those who need to repeatedly process txt, doc, docx, PDF, or other office files, this batch processing approach can significantly save time.
Preview Before Processing: Multiple Pending TXT Files in the Folder
Before processing, the example folder contains 5 TXT files, named big_bang.txt, black_holes.txt, dark_energy.txt, dark_matter.txt, and galaxies.txt respectively. These are all text documents. If processed one by one, you would need to repeatedly perform actions like opening, finding, replacing, saving, and closing.

Opening black_holes.txt shows the main body is an English passage with several digits distributed within. For example, the "10" and "30" marked in the screenshot, as well as "5", "100", "4", "26,000", etc., appearing elsewhere in the text. These digits are not the same keyword, so inputting a single fixed digit cannot complete all the replacements.

If processed manually, you would face at least two problems: first, you'd need to find all digits in each file, which is prone to omission; second, different digits have different lengths, making it cumbersome to list replacement rules one by one. Using a regular expression allows you to represent "all consecutive digits" with a single rule, enabling the software to complete the matching automatically.
Preview After Processing: All Matched Digits Replaced with AAA
After the process is complete, checking black_holes.txt again shows that positions where digits previously appeared have now become "AAA". For instance, the black hole radius, mass multiple, solar mass quantity, distance value, and other positions have all been replaced according to the same rule.

This result demonstrates that batch find and replace is not simply replacing one fixed character, but identifies digital content of different lengths uniformly based on the \d+ rule, and then replaces it with the specified text. For a large number of TXT files, this method is more stable than manual individual processing and easier to reuse.
Operating Steps: Complete Batch Find and Replace Following the Wizard
The operation flow is explained below with software screenshots. The overall idea is: first enter the Text Tools function module, then import files, then set the search rules and replacement content, and finally choose a save location and execute the process.
Step One: Open the Find and Replace Function in Text Tools
After launching HeSoft Doc Batch Tool , select "Text Tools" in the left navigation bar. Multiple batch functions related to text files will be displayed on the right. Find and click "Find and Replace Keywords in Text". In the screenshot, this function is item 1 on the list, indicating it is the entry point for batch replacing text content.

The purpose of choosing this function is to let the software enter the dedicated batch text find and replace process. Unlike standard text editors, this supports adding multiple files as records to a task, and all subsequent rules will be applied to these records. This step is crucial for situations where multiple TXT files need unified modification.
Step Two: Add Files or Import TXT from Folder
After entering the function page, the current function name "Find and Replace Keywords in Text" is displayed at the top, and the progress bar shows Step 1 is "Select records to process". "Add File" and "Import Files from Folder" buttons are in the upper right corner. In the example, 5 TXT files have been imported, and the file list shows their name, path, extension, creation time, and modification time.

If the number of files is small, you can click "Add File" to select them individually; if all files are in the same directory, using "Import Files from Folder" is more efficient. After importing, it's recommended to check the file names and paths in the list to confirm no incorrect files were imported. The bottom of the interface shows the record count is 5, indicating this task will process 5 file records.
After confirming the file list is correct, click "Next" at the bottom. The expected result of this step is: all TXT files needing batch keyword replacement have entered the pending processing list, eliminating the need to open files individually later.
Step Three: Set Search Mode to Formula Fuzzy Search
Upon entering Step 2 "Set processing options", the first thing is to choose the search mode. The interface shows two options: "Precise text search" and "Use formula for fuzzy text search". Since the goal here is to process all digits, not a specific fixed one, you should select "Use formula for fuzzy text search".

This choice determines how the software interprets your input for the search. If precise search is selected, the input will be treated as plain text; if formula fuzzy search is selected, the input rule can be used to match a category of text. The \d+ in this article is an expression for searching digits based on rules.
Step Four: Enter the Wildcard Regular Expression to Find
Enter \d+ in the "List of Keywords to Find" on the left. This expression consists of two parts: \d represents a digit, and + means one or more occurrences. Therefore, it can match consecutive digits like "1", "10", "100", "26000".
When batch replacing in multiple text files, the advantage of this approach is not needing to know in advance exactly which digits are in each file. As long as they conform to the rule of consecutive digits, the software can find them automatically. This rule is commonly used for log serial numbers, statistical values, quantity fields, and numerical descriptions in English documents.
Step Five: Set the Replacement Keyword to AAA
Enter "AAA" in the "List of Replacement Keywords" on the right. This creates a replacement rule: replace all consecutive digits matched on the left with AAA. The screenshot shows \d+ entered on the left and AAA on the right, indicating the search rule and replacement result are now paired.
In practice, you can replace with other content based on business needs. For example, replace with "***" for data hiding, "{Digits}" for template placeholders, or "NUM" for test data. Regardless of the replacement text, it's advisable to test with a small number of files first to confirm the rule's hit range meets expectations.
Step Six: Set Save Location and Start Batch Processing
After completing the processing option settings, continue clicking "Next". The interface flow shows subsequent steps for "Set save location" and "Start processing". When setting the save location, it's recommended to choose a new output folder to distinguish between original files and processed files. Overwriting the original files directly might cause trouble if you later discover the rule settings were incorrect.
After entering the start processing step, execute the batch process according to the interface prompts. The software will apply the rules sequentially to the multiple TXT files in the list, replacing digits matching \d+ with AAA. After processing, it's recommended to spot-check one or two files, such as black_holes.txt, to confirm the processing result matches the preview.
Common Questions and Precautions
1. Are wildcards and regular expressions suitable for all replacement tasks?
Not exactly. For fixed-word replacements, using precise text search is simpler; for text with similar formats but different content, using formula fuzzy search or regular expressions is more appropriate. For example, replacing all digits, uniformly processing serial numbers, or matching strings of a specific format are suitable for rules.
2. What content will \d+ replace?
\d+ will match consecutive digits. If the text contains "100", it will be matched as a whole segment; for "26,000", because of the comma in between, it might be processed as two separate consecutive digit segments, "26" and "000". Therefore, when processing numbers with delimiters, you need to assess whether a more complex rule is required based on the end goal.
3. Why is it recommended to back up before batch replacement?
Batch processing is highly efficient, but this also means its impact range is substantial. An incorrect rule could modify multiple files at once. For safety, it's recommended to keep the original files or set a separate save location in the software. After processing, compare and check to confirm correctness before using the results on official materials.
4. Can I import an entire folder at once?
As seen in the screenshot, the function page provides an "Import Files from Folder" button, so when multiple TXT files are in the same directory, they can be imported through this entry. After import, it's still recommended to check the list to avoid adding files that shouldn't be processed to the task.
5. Can this method be extended to Word, docx, doc and other files?
What this article demonstrates is TXT batch find and replace in Text Tools. For Word documents, such as doc and docx files, you should select the processing entry based on the corresponding Word tool or related functions within the software. Different file formats have different internal structures; you cannot simply equate the TXT processing flow with Word or PDF processing. However, the idea of "batch import files, set rules, and process uniformly" remains consistent.
Summary: Leave Repetitive Find and Replace to Batch Processing Tools
Through this example, we can see that manually replacing the large quantity of different digits present in multiple TXT files is not an efficient solution. Using HeSoft Doc Batch Tool , you can first import multiple text files into a task list, then set the \d+ rule via "Use formula for fuzzy text search", and finally uniformly replace all matched digits with AAA. The entire process is clear, reusable, and facilitates applying consistent processing standards to large batches of files.
If you often need to organize text documents, clean log files, or replace keywords across multiple files, it's highly recommended to prioritize this batch processing method. First, prepare test files to confirm the regular expression and replacement content are correct, then apply in batch to the official folder. This not only reduces repetitive labor but also lowers the risk of manual omissions and operational errors, making text file processing more aligned with the requirements of efficient office work.