TToolbox
⇋

Find & Replace

Batch find and replace with regex

About this tool

Batch find and replace is a fundamental productivity requirement across long-form manuscript editing, codebase refactoring, log sanitization, and data wrangling. Manually tracking down hundreds of text occurrences is tedious and prone to accidental omissions. This tool delivers client-side bulk text replacement, supporting exact substring matches, advanced regular expressions with capture group backreferences ($1, $2), and case sensitivity switches.

How to Use This Tool (Step-by-Step)

1

Enter Source Text

Paste your raw document, log records, or code snippets into the main editing workspace.

2

Configure Match and Replace Rules

Type your search query or regex pattern, specify the replacement string, and toggle case sensitivity or regex evaluation.

3

Execute Replace and Copy Output

The tool immediately calculates match counts. Click 'Replace All' to execute the transformation, then copy the result with one click.

Regex & Backreference Support

Supports advanced capture group backreferences (`$1`, `$2`), allowing structural text reordering and pattern-based formatting.

Real-Time Match Count Counters

Displays live match frequency tallies before executing, preventing accidental bulk overrides on ambiguous words.

100% Client-Side Air-Gapped

Processing runs entirely inside your browser's V8 engine. Proprietary legal contracts and sensitive records remain strictly confidential.

Batch Replacement Safety & Best Practices

  • •Use word boundaries `\b` to avoid sub-word bugs: Blindly replacing 'cat' with 'dog' corrupts 'category' into 'doggory'. Wrap terms in `\bcat\b`.
  • •Parentheses required for `$1`: Backreferences in the replacement box require corresponding capturing parentheses `(...)` in the search regex.
  • •Backup source text before chained replacements: Successive global substitutions can irreversibly mangle text. Keep a backup copy handy before batch operations.

Code & Transformation Examples

Regex Date Formatting with Capture Groups

Find & Replace Expression
查找内容 (Regex): (\d{4})-(\d{2})-(\d{2})
替换内容 ($1 $2): $2/$3/$1
Replacement Output
原始文本: "活动定于 2026-09-23 举行,截止日为 2026-12-31。"
替换结果: "活动定于 09/23/2026 举行,截止日为 12/31/2026。"

* `$1`, `$2`, and `$3` correspond to year, month, and day capture groups, reordered effortlessly.

JavaScript String Replace All Snippet

Literal replaceAll
// 现代 ES2021 原生全部替换字面量
const result = text.replaceAll("旧词", "新词");
Regex Global Replacement
// 正则带 g 标志位实现全量替换
const regex = new RegExp("oldWord", "gi");
const newText = text.replace(regex, "newWord");

* Always escape special metacharacters like '.' or '*' when constructing dynamic RegExp objects from user input.

Frequently Asked Questions

Q: Why did regex mode mangle my punctuation text?

A: When regex mode is active, characters like `.` and `*` act as wildcards rather than literal punctuation. Turn off regex mode for simple string matching.

Q: How do I delete matched keywords entirely?

A: Leave the 'Replace With' field completely empty and execute. All matched substrings will be deleted instantly.

Q: Does it support multiline line-feed replacements?

A: Yes. Enable regex mode and search for `\r?\n` or `\n` to match line breaks, replacing them with commas or spaces to collapse lists into a single line.

Related Tools

All processing happens locally in your browser. Your data is never uploaded to a server.
/