This article uses batch deletion of numbers in TXT files as an example to illustrate how to utilize the batch find and replace function of office software to process multiple text files. Through HeSoft Doc Batch Tool , users can import multiple txt files at once, choose to use formula-based fuzzy text search in the find mode, enter the regex rule \d+ to match consecutive numbers, and keep the replacement keyword list empty, thus achieving batch deletion of the matched content. The article also explains the effects before and after processing, the purpose of the steps, and operational considerations.
In the process of document organization, data cleaning, and content archiving, the most troublesome part is often not a single complex operation, but a large number of repetitive small operations. For example, a batch of TXT files all contain numeric keywords, which might be serial numbers, page numbers, statistical values, distances, years, or temporary markers. You need to delete all of this content, but with many files, opening and editing them one by one in a text editor is both slow and error-prone. This article uses a practical example to explain how to use HeSoft Doc Batch Tool to batch delete matching content in text files using wildcard regular expressions.
The example rule is \d+, which is used to match consecutive digits. By leaving the "replaced keyword list" empty, all matched digits can be deleted. This method reflects the core value of batch processing software for office work: setting up rule-based, highly repetitive tasks once and letting the tool complete them.
Applicable Scenario: Deleting a Type of Text by Rule, Not a Fixed Word
When many users search for "batch delete text keywords," their actual need is not just to delete a fixed word, but to delete a category of content that follows a pattern. For example, deleting all numbers, all serial numbers, code in a certain format, markers in parentheses, or the same advertising phrase in each file. If the content is exactly identical, an exact search can be used; if the content is similar in form but has different specific values, wildcards or regular expressions are more suitable.
In this example, "10," "30," and other different numbers appear in black_holes.txt, and other txt files likely have their own different numbers. To delete all these numbers, searching for each individual number is obviously unrealistic; using a rule like \d+ can cover numeric content of various lengths in one go. This batch processing method is very practical for text files like txt, logs, exported data, and documents.
Result Preview: Multiple TXT Files Pending Processing Visible Before Processing
Before processing, the folder contains multiple text files that need cleaning. The screenshot shows files like big_bang.txt, black_holes.txt, dark_energy.txt, dark_matter.txt, galaxies.txt, etc. Although there are only 5 files in this case, in real work, there might be dozens or hundreds, and the cost of manual processing increases quickly.

Opening black_holes.txt reveals multiple numbers in the main body. The screenshot uses red boxes and arrows to mark numbers like "10" and "30," which are the targets to be deleted using the regular expression rule this time.

Result After Processing: Matched Digits Deleted, Text Body Preserved
After processing, reopening black_holes.txt shows that the original numeric content has been removed from its locations. The text body remains, with only the matched digits replaced by emptiness. The green markers in the screenshot help observe the changes after deletion.

As can be seen from the results, this method does not delete entire lines or paragraphs, but only the matched keyword fragments. This is highly suitable for tasks that require preserving the article body while cleaning only partial content. If your goal is to delete complete lines containing a certain keyword, you should choose a feature related to "whole lines"; this article discusses deleting matching keywords within the text.
Operation Steps: Using HeSoft Doc Batch Tool to Delete Content Matching a Regular Expression
Step 1: Open the Find and Replace Feature in the Text Tools
On the main interface of HeSoft Doc Batch Tool , select "Text Tools" on the left. In the feature cards on the right, click "Find and Replace Keywords in Text." The description for this feature is batch find and replace keywords in text file content, which perfectly matches the need to batch delete content in TXT files.

The purpose of this step is to select the tool for processing "file content." Many batch software programs also offer capabilities for file names, folder names, format conversion, etc., but this time the task is to process the body content of txt files, so we should enter the text find and replace process.
Step 2: Import the Multiple Text Files to Be Processed
After entering the feature page, first add files in the "Select records to process" step. The top of the interface provides options to "Add Files" and "Import Files from Folder." In the example, 5 txt files have been imported, and the table shows file names, paths, extensions, creation times, and modification times.

It is recommended to develop the habit of checking the list after import: verify if the file extension is txt, check if the paths are correct, and see if the record count matches expectations. If you find a mistakenly added file, you can use the operation entry in the list to remove the corresponding record; if you need to re-select, you can also use the clear function provided on the interface to re-import. After confirming, click "Next Step."
Step 3: Set the Search Method to Use Formula for Fuzzy Text Search
On the "Set Processing Options" page, locate the "Search Method." This example selects "Use Formula for Fuzzy Text Search," not "Exact Text Search." This option is highlighted with a red box in the screenshot.

The reason for choosing this mode is: we want to delete all numbers, not a specific fixed number. Regular expression or wildcard rules can describe a category like "consecutive digits," so they are suitable for fuzzy rule matching.
Step 4: Enter \d+ in the Keyword List to be Found
Enter \d+ in the left "List of keywords to be found." Its meaning can be simply understood as: find one or more consecutive digits. During actual matching, "5," "10," "100," "26000," etc., in the text will all be identified.
Keep the right "List of keywords after replacement" blank. The interface prompts "leaving it blank means deletion," so not filling in replacement content achieves the deletion effect. If you want to uniformly replace numbers with a placeholder, such as "number," you could fill in the corresponding text on the right; but the goal of this example is deletion, so leave it empty.
Step 5: Set the Save Location, Execute, and Spot Check the Results
After completing the processing options, follow the workflow, click "Next Step" to enter "Set Save Location," and then proceed to "Start Processing." To ensure data security, it is recommended to output to a new folder first, or back up the original files in advance. Batch deletion is an operation that affects content; if a rule is written too broadly, it might delete more than expected.
After processing is complete, open at least one or two result files for spot-checking. Focus on checking whether numbers have been deleted from their original positions, whether paragraphs look normal, and whether there are any unwanted space issues. After the example processing, the numbers in black_holes.txt are no longer displayed, indicating the batch deletion was successful.
Common Questions and Precautions
1. How to Choose Between "Use Formula for Fuzzy Text Search" and "Exact Text Search"
If you need to delete fixed words, like "advertisement," "test," or "draft," you can use Exact Text Search. If you need to delete a category of content, such as all numbers, different serial codes, or code snippets of different lengths, it is more appropriate to use Use Formula for Fuzzy Text Search.
2. What to Do If the Text Feels Unnatural After Deleting Numbers
This example only deletes numbers and does not automatically rewrite sentences. Therefore, spaces, units, and punctuation marks around the numbers might remain. You can perform another blank space cleanup according to your needs, or design a more complete matching rule before formal processing. For important documents, spot-checking multiple locations is recommended.
3. Why Test with a Small Number of Files First
Regular expressions are efficient but require caution. \d+ will match all consecutive digits, which has a very broad range. Testing with a small number of copies first confirms whether the rule meets expectations, before batch processing all files, preventing the expansion of errors.
4. Can files like docx, doc, PDF be batch processed?
The screenshots in this article show the processing flow for TXT files under Text Tools. For formats like Word's docx, doc, or PDF, you need to select the corresponding tool type in the software and confirm whether that feature supports content find and replace. The structure of different file formats varies, so it is not recommended to directly apply the TXT processing flow.
Summary: Regular expression rules combined with batch tools make text cleaning more efficient
Using wildcard regular expressions to batch delete keywords in text files is suitable for tasks with clear rules but a large number of files. Through HeSoft Doc Batch Tool , users can import multiple txt files at once, set up search rules and replacement results in the same workflow, turning repetitive manual deletion into automated batch processing.
If you also have a batch of text files that need cleaning, it is recommended to first copy sample files, input \d+ following the steps in this article and leave the replacement content empty, confirm the processing results are correct, and then process the complete directory. This not only saves a lot of time but also ensures consistency in the cleaning standards for batch files.