Skip to content
UniKit

Batch text replacement

Batch-replace pasted file content with multiple rules: one 查找=替换 per line, optional regular expressions with $1 back-references, case sensitivity and first-match-only mode, plus per-rule counts — all local.

Runs in your browserEvery computation happens in your browser — your data never leaves this device.

Paste the clipboard content directly — no file upload needed. CRLF / LF / CR are all recognised.

The first = separates the search text from the replacement; blank lines and lines starting with # are ignored; \n and \t are expanded in the replacement. Rules run top to bottom.

Replaced text

Every replacement runs in your browser; the rules never leave your machine.

Fill in the content and the rules to see the result

What this tool does

  • Replace several fields across a whole config or data file at once, such as swapping an old domain for a new one
  • Normalise Chinese punctuation, units or placeholders pasted from a spreadsheet
  • Tidy up log files with regular expressions: swap yyyy-mm-dd and mm/dd/yyyy, drop repeated spaces

Example

Input

苹果10元
香蕉12元

Output

苹果10块
香蕉12块

The single rule is 元=块. Case sensitive and replace-all are the defaults; write three rules on three lines and they run top to bottom.

Frequently asked questions

How do I write a rule?

One rule per line, written as search=replace. The first = is the separator, so the replacement may itself contain = (key=value=done turns key into value=done). Blank lines and lines starting with # are ignored so you can comment your rules. A rule with an empty search text (=abc) is rejected.

Are regular expressions supported?

With "Regular expressions" enabled the search text is interpreted as a JavaScript regex (case sensitivity follows the switch) and the replacement supports $1, $2 back-references and $&. An invalid pattern, such as an unbalanced bracket, is reported as a compile error. With the switch off both sides are literal: . * + are not metacharacters and $1 in the replacement is not expanded.

Do multiple rules interact?

Yes. Rules run top to bottom and each one works on the output of the previous one, so search a=b followed by b=c turns the original a into c, and text created by an earlier rule can be rewritten by a later one. Put the more specific rules first to avoid such chained effects.

What is "Only the first match per line" for?

By default every match is replaced. With this option only the first match on each line changes, which suits cases like renaming only the leading field name. In that mode rules never match across line breaks and the output uses LF line endings.

Does it read my files or use the network?

No. You paste the file content yourself and the replacement runs in your browser; the tool neither uploads anything nor touches the file system. The statistics show how many hits each rule had and how many lines changed.

Keywords:batch replacereplace-txtoffline

Related tools