How to Use
This tool supports multiple replacement rules, allowing you to flexibly handle various text replacement needs. Here is a detailed guide:
Basic Replacement
Paste your text in the left input box, then add replacement rules below. Each rule has a "Find" and "Replace with" field. After clicking "Replace", the tool will execute replacements in order. The final result will appear in the right output box.
Regex Mode
When regex mode is enabled, the search string is treated as a regular expression. Full JavaScript regex syntax is supported, including character classes ([a-z]), quantifiers (*, +, ?), anchors (^, $), and capture groups ((...)). For example, searching for \\d{4}-\\d{2}-\\d{2} in regex mode can match date formats.
Multiple Rules & Execution Order
The tool supports adding multiple replacement rules, executed from top to bottom. This means you can apply one rule first, then use the next rule on the result. For example, first replace all spaces with underscores, then replace underscores with hyphens.
Undo & History
After each replacement, the tool automatically saves the current original text to the history. If you need to revert, simply click the "Undo" button. Up to 20 steps of history are saved, which covers most use cases.
Use Cases
Code Refactoring & Formatting: When migrating or refactoring code, you often need to batch-replace variable names, function names, or API paths. For example, replace an old API domain with a new one across the project, or change naming conventions from camelCase to snake_case. Regex mode helps you precisely match specific patterns, such as replacing all var keywords with let.
Data Cleaning & Preprocessing: When processing data from various sources, you often need to standardize and clean formats. For example, unify date formats to ISO standard (YYYY-MM-DD), clean extra whitespace and special characters, or replace Chinese punctuation with English equivalents.
Document Batch Editing: When editing large volumes of documents, quickly batch-replace specific terms, update version numbers, or fix typos. For example, replace all "v1.0" with "v2.0", or update old company branding to new branding.
Extended Knowledge
Regular Expression Basics: A regular expression (Regex) is a powerful text-matching tool that uses special symbols to describe character patterns. Common metacharacters include: . matches any character, * matches 0 or more times, + matches 1 or more times, ? matches 0 or 1 time, ^ means start of line, and $ means end of line. Character classes like [a-z] match lowercase letters, and \d matches digits.
Capture Groups & Backreferences: Using parentheses (...) creates capture groups, which can be referenced in replacement with $1, $2, etc. For example, finding (\\d{4})-(\\d{2})-(\\d{2}) and replacing with $3/$2/$1 converts dates from "2024-03-15" to "15/03/2024".
Regex Flags: This tool supports global matching (g) and case-insensitive matching (i). Global match replaces all occurrences, not just the first one. Case-insensitive matching makes the search ignore letter case. Note: In regex mode, . does not match newlines by default; use [\\s\\S] if you need to match across lines.
FAQ
Does this tool upload my data?
No. All operations are performed locally in your browser using pure frontend JavaScript. No network requests are made to send data to any server. You can verify this by opening the developer tools (F12) and checking the Network tab.
Does it support regular expressions?
Yes. The tool provides a regex mode toggle. When enabled, the search string is treated as a regular expression. It supports capture groups and backreferences, for example replacing (\d{4})-(\d{2})-(\d{2}) with $3/$2/$1.
How many replacement rules are supported?
The tool supports up to 50 replacement rules, which is more than enough for most complex scenarios. Each rule can independently toggle regex mode and case sensitivity. Rules are executed in order from top to bottom.
Can I undo a replacement?
Yes. The tool has a built-in history feature that automatically saves the original text after each replacement. You can click the "Undo" button to revert to the previous state. Up to 20 steps of history are saved.
What special characters are supported?
In non-regex mode, the tool matches the search string literally. In regex mode, full JavaScript regular expression syntax is supported, including anchors (^,$), character classes ([a-z]), quantifiers (*,+,?), grouping (()), and backreferences ($1,$2).
Are special characters escaped in the replacement result?
No, they are not automatically escaped. The replacement text is inserted into the result exactly as written. If you need to use special characters in the replacement, you can use special replacement strings like $&, $', $`, or $n in regex mode.