When multiple TXT files contain a large number of digits, numbers, statistics, or temporary tags, opening each file to manually delete them is not only time-consuming but also prone to omissions. This article uses HeSoft Doc Batch Tool as an example to demonstrate how to use wildcards/regular expressions to batch find numeric keywords in text, leaving the replacement empty, thereby deleting matching content in multiple txt files at once. The article includes before-and-after comparisons, complete operating steps, and common considerations, suitable for office scenarios requiring batch text cleanup, data organization, log processing, or document content standardization.
In daily office work, material organization, content cleaning, or data archiving, you often encounter a common problem: a folder contains many TXT text files, each containing numbers, codes, statistical values, version numbers, or temporary markers that you don't need to keep. If there are only one or two files, manually opening a text editor to delete them individually is acceptable. However, when the number of files grows to dozens, hundreds, or even requires daily repetitive processing, manual searching and deleting becomes extremely inefficient and tedious.
This article aims to solve the problem of "how to use wildcard regular expressions to batch delete keywords from many text files." Taking the office software " HeSoft Doc Batch Tool " shown in the screenshot as an example, it demonstrates how to import multiple TXT text files into the software at once, use the "Find and Replace Text Keywords" function, apply the regular expression \d+ to match consecutive numbers in the text, and leave the replaced keyword list empty, thereby achieving the effect of batch deleting numeric keywords.
The core value of this method is: you don't need to open files individually, search location by location, or manually delete each matched item. As long as you set up the search rules, the software can batch process multiple text files, which is especially suitable for scenarios like office document cleanup, text data desensitization, batch removal of numbering, log content organization, and content format unification.
Applicable Scenarios: When to Use Regex for Batch Deletion of Text Keywords
Using regular expressions to batch delete text keywords is suitable for scenarios where "the content to be deleted shares common patterns, but the specific content is not exactly the same." For example, in this article's case, many numbers appear in the text file, such as "10", "30", "100", "26000", etc. Using a regular find function would require entering each specific number one by one; using the regular expression \d+ can match all consecutive numbers at once.
Common applicable scenarios include the following:
- Batch deleting numbers in TXT files: For instance, years, statistical values, codes, measurements, page numbers in articles that are no longer needed and need to be cleared uniformly.
- Batch cleaning dynamic keywords in text: For example, order numbers, serial numbers, IDs, temporary codes, etc., where the format is similar but the specific values differ in each file.
- Batch processing English or Chinese materials: Whether it's English TXT, Chinese TXT, or plain text content exported from web pages, logs, or systems, as long as it's a text file, the find-and-replace approach can be used for batch cleaning.
- Batch desensitization or content standardization: Before publishing materials, you may need to remove sensitive codes, internal markers, test data, or numeric information you don't wish to disclose.
- Reducing repetitive office operations: When multiple files require the same find-and-delete rule, using office software for batch processing is more stable and time-saving than manual editing.
It should be noted that this article's example focuses primarily on TXT text files. If your office workflow also involves Word documents like doc or docx, or formats like PDF or HTML, you should select the appropriate function based on the corresponding tool module in the software. The screenshot currently shows the "Text Tools" section, so this article emphasizes batch finding, replacing, and deleting within text file content.
Effect Preview: Before Processing, Multiple TXT Files Contain Numbers to be Deleted
From the file list before processing, you can see there are multiple TXT files in the folder to be processed, such as big_bang.txt, black_holes.txt, dark_energy.txt, dark_matter.txt, galaxies.txt. These files belong to the same batch of text materials. Manually opening, checking, and deleting numbers from each one would be very time-consuming.

Upon opening black_holes.txt, you can see the main text contains several numbers, such as "10", "30", etc. These numbers are scattered across different sentences and may appear as different values in other TXT files. For this situation, using a regular expression for batch matching is ideal, because what we truly want to delete is not a single fixed number, but the category of "all consecutive numbers."

Using traditional methods would require you to repeatedly perform find, locate, delete, and save operations in each file. The more files you have, the more likely you are to experience missed deletions, accidental deletions, or forgetting to save. By using HeSoft Doc Batch Tool , you can first import all the TXT files that need processing into a list, then uniformly set the find and replace rules, and finally execute them in a batch.
Effect Preview: After Processing, Numeric Keywords Have Been Batch Deleted
After processing is complete, opening the same black_holes.txt file again shows that the locations where numbers previously appeared are now blank, indicating the matched numeric content has been deleted. For example, numeric phrases in the original text like "about 3 kilometers", "with 10 times", and "roughly 30 kilometers" have been cleaned up, leaving only the other text content.

From the results, you can see that this operation did not just delete one specified number; rather, it uniformly deleted all numbers matching the rule via a regular expression. For batch deleting keywords from text files, this method is more flexible: next time, if you need to delete emails, phone numbers, content within brackets, or content between specific prefixes and suffixes, you can adjust the regular expression according to the actual pattern.
Of course, batch deletion directly affects file content, so it is recommended to prepare backup files before formal processing, or save the processing results to a new location. This way, even if the regex rule is not perfectly accurate, you can revert to the original files for reprocessing, avoiding irreversible content loss.
Operation Steps: Using HeSoft Doc Batch Tool to Batch Delete Numbers in TXT Files
The complete operational flow based on the screenshot sequence is described below. This article uses deleting all numbers in the text as an example, employing the search expression \d+ with the replacement content left empty. You can also replace the expression with other wildcards or regex rules according to your actual needs.
Step 1: Enter Text Tools, Select "Find and Replace Text Keywords"
After opening HeSoft Doc Batch Tool , select "Text Tools" from the left function bar. On the Text Tools page, you will see multiple batch processing functions related to text files, such as Text to Word, Text to PDF, Delete Blank in Text, etc. The function needed for this article is the first one: "Find and Replace Text Keywords."

The purpose of selecting this function is to have the software uniformly search for specified content across multiple text files and replace it according to the settings. When the replacement content is empty, it effectively deletes the found content. Therefore, "Find and Replace" can be used not only for batch word changes and batch phrase replacement but also for batch deleting keywords.
After entering this function, the software will present a step-by-step processing interface. The screenshots show the process divided into "Select records to process", "Set processing options", "Set save location", "Start processing", etc. This process-oriented design helps reduce omissions: confirm the files first, then the rules, and finally execute the process.
Step 2: Add Files or Import TXT Files from a Folder
After entering the function page, the first step is to select the records to be processed. The upper right corner of the screenshot provides operation entries like "Add File", "Import files from folder", "Clear", "More". For a small number of files, you can use "Add File"; if a folder already centrally stores all the TXT files, you can use "Import files from folder" to add the text files from that folder to the processing list all at once.

In the example, the software has imported 5 TXT files, with the list displaying information such as file name, path, extension, creation time, and modification time. The files include big_bang.txt, black_holes.txt, dark_energy.txt, dark_matter.txt, and galaxies.txt. The expected outcome of this step is: all text files from which you want to batch delete numeric keywords appear in the list, and the record count is correct.
It is recommended to check two things before clicking "Next". First, confirm that no files needing to be excluded were added to the list; second, check whether the file extensions meet expectations (e.g., all are TXT in this case). If there are files in the list you don't want to process, you can remove them using the delete icon in the operation column. After confirming, click the "Next" button at the bottom to proceed to set processing options.
Step 3: Choose to Use Formula for Fuzzy Text Search
The second step is to set the keyword options. In the screenshot, the "Find Method" provides two options: "Find Exact Text" and "Use formula for fuzzy text search." Since this article aims to delete all numbers, not a specific fixed number, you should select "Use formula for fuzzy text search."

This option can be understood as using wildcards or regular expressions for matching. Regular exact search is suitable for finding perfectly matching terms, like replacing "black hole" in all files with another fixed phrase; formula-based fuzzy search is more suitable for processing content with patterns, such as numbers, dates, codes, emails, etc.
You can also see the additional option "Ignore Case of Letters" in the screenshot. For the number deletion scenario in this article, case sensitivity is irrelevant and can be left unchecked. If you are processing English keywords, e.g., matching "Word", "word", and "WORD" simultaneously, you can decide whether to enable this option based on your actual needs.
Step 4: Enter the Regular Expression \d+ in the Keywords List to Find
Enter \d+ into the "Keywords List to Find." This is a common regular expression pattern, where \d represents a digit character, and + means matching one or more consecutive occurrences of the preceding element. Therefore, \d+ can match numbers of different lengths like "3", "10", "30", "100", "26000".
This step is critical because the accuracy of the batch deletion depends on whether the search rule is correct. If you only input a fixed number like "10", the software will only process "10" in the text; but by inputting \d+, all consecutive numbers become match targets. For the need to batch delete numeric keywords in text files, this rule is more appropriate.
If your goal is not to delete numbers but to delete other types of content, you can replace it with the corresponding rule. For example, to delete a fixed word, input that word; to delete a specifically formatted code, you need to write an expression based on the code structure. This article does not expand on complex regex syntax, focusing instead on illustrating the concept of batch deletion through the software interface.
Step 5: Leave the Replaced Keywords List Empty to Achieve Deletion
The right side of the screenshot shows the "Keywords List after Replacement," and the interface prompts "Leave blank to delete." Therefore, if the goal is to delete the matched numbers, do not enter any content on the right side; keep it empty.
The logic of this step is: the left side defines "what to find," and the right side defines "what to replace with." When the right side is empty, the software replaces the matched content on the left with an empty character, which means deletion. This completes the operation of batch deleting numeric keywords in TXT files.
After completing the settings, you can continue by clicking "Next." Based on the interface flow, subsequent steps will involve entering the save location setting and the processing start phase. Although the current screenshot doesn't show the details of subsequent pages, you can reasonably infer from the top step bar that the software will prompt you to confirm how to save the processing results before executing the batch process.
Step 6: Set the Save Location and Start Processing
After completing the find and replace rule settings, enter the "Set save location" phase. For data security, it is highly recommended to save the processed files to a new folder first, rather than directly overwriting the original files. Especially when using regular expressions for batch deletion, if the expression's scope is set too broadly, it might delete more content than expected. Saving to a new location preserves the original files, facilitating comparison and rollback.
After confirming the save location, enter the "Start processing" phase. Once execution is complete, you can open the processed files for spot checks. It is recommended to check at least one file containing typical content, such as black_holes.txt in this article, to confirm that numbers were deleted as expected and that other text remains intact. If the results meet expectations, you can then use the processed files for subsequent publication, archiving, or analysis.
Frequently Asked Questions and Precautions
1. What content will \d+ delete?
\d+ is typically used to match consecutive digits. This means whether the number is 1 digit, 2 digits, or more, as long as they appear consecutively, they will be matched and deleted. For example, "10", "30", "100", "26000" all fall within the matching scope. After processing, these numeric positions will become blank.
2. Why are spaces left behind after deleting numbers?
From the processed effect diagram, you can see that after numbers are deleted, spaces might remain where the numbers originally were. This is because the software only deletes the matched numbers themselves; the spaces, punctuation, or other text surrounding the numbers are kept. If you wish to further clean up extra spaces, you can combine other text processing functions within the software, or incorporate adjacent spaces into the matching scope of your regex rule based on the actual situation. However, when unsure about the rule's impact range, it's not advisable to be overly aggressive from the start.
3. Can I delete only certain specific numbers, rather than all numbers?
Yes, you can. If you only want to delete a fixed keyword, you can use "Find Exact Text" and input the specific content. If you only want to delete numbers in a certain format, you need to adjust the regular expression. For example, deleting only three-digit numbers, or only numbers following a specific prefix, would involve more granular rule design. The goal of this article's example is to batch delete all consecutive numbers, hence using \d+.
4. Is a backup necessary before batch processing?
A backup is recommended. Batch processing files is highly efficient, but it also means a single setting can affect multiple files. Especially when using regular expressions, writing a rule incorrectly can lead to accidental deletion. Therefore, it's best to make a copy of the original folder before formal processing, or select a new output directory when setting the save location in the software.
5. Is this method suitable for Word documents like doc or docx?
The screenshots in this article show the TXT batch find and replace scenario within the Text Tools, which is suitable for processing plain text files like TXT. If you need to process Word documents (e.g., doc, docx), you must enter the Word-related tool modules in the software and follow the corresponding functions. The content structures of different file formats are different, so you cannot simply equate the TXT processing flow with the Word processing flow.
Summary: Turn Repetitive Deletion into a Single Setup with a Batch Processing Tool
Batch deleting keywords from multiple text files essentially delegates repetitive manual editing tasks to office software. Through the "Find and Replace Text Keywords" function in HeSoft Doc Batch Tool , you can first import multiple TXT files, then select "Use formula for fuzzy text search," input \d+ to match all numbers, and leave the replacement content empty, thereby achieving batch deletion of numeric keywords.
Compared to manually opening files and deleting content one by one, this method is more suitable for office scenarios involving a large number of files, clear rules, and repetitive processing needs. It not only saves time but also reduces the risk of missed deletions and operational inconsistency. It is recommended that you first prepare test files or backup files in practice, confirm the regular expression's effect is correct, and then execute the processing on the entire batch of text files. This way, you can leverage the efficiency advantage of batch processing while ensuring the safety and controllability of the file content.