Skip to content
UniKit

Multi-rule text replacer

Apply many find-and-replace rules to text at once: literal or regex matching, case sensitivity, whole-word mode, per-rule toggles and rules pasted from text, with the replaced output plus per-rule match counts and rule-indexed regex errors.

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

Text to replace in

Everything runs locally in your browser; the text is never uploaded.

Format: find => replace (also -> or a tab). A leading ! disables a rule, a find side written as /regex/i is a regular expression, and \n \t \\ are unescaped to newline / tab / backslash. Lines starting with # are comments.

Rule list

Pasted rules run first, the rule list below runs afterwards, and each rule sees the output of the previous one.

Replaced text

Rules are applied in order; the output shows the resulting text and how many times each rule matched.

Enter text and rules to replace in bulk

What this tool does

  • Rename a batch of terms at once (company names, jargon, placeholders) without running Ctrl+H over and over
  • Redact data with regex rules: turn order ids, phone numbers or dates into placeholders and check how many times each rule matched

Example

Input

北京欢迎你,欢迎来到北京!
订单号 1024 来自 2024 年

Output

上海欢迎你,欢迎来到上海!
订单号 N 来自 N 年

Rules: 北京 => 上海 (2 matches) and /\d+/ => N (2 matches); rules run in order, so each one sees the output of the previous rule.

Frequently asked questions

Do the rules run at once or in order?

In order: rule 2 sees the text produced by rule 1, so chained replacements are possible (A becomes B, then B becomes C). That is what makes composable rules such as "trim spaces first, then normalise case" work. To avoid chaining, run the tool twice or put the content you do not want to match again in a later rule.

Can regex rules use $1 and the case switch?

The regex mode (find side written as /…/, optionally with the i flag, or the regex option in the list) keeps $1 $2 backreferences. The literal mode searches for the exact text and inserts the replacement verbatim, so $ is not interpreted. The case switch applies to both modes: disabled means matching ignores case (implemented with the regex i flag).

Does whole-word matching work for Chinese?

Mostly no. Whole-word mode relies on the regex \b word boundary, and \b only recognises ASCII word characters (letters, digits, underscore). Chinese characters are not word characters, so there is no boundary next to them and a Chinese pattern may not match at all. Whole-word is meant for English text and code identifiers (for example replacing the standalone log without touching logging).

What happens when a regex is invalid?

You get an error that names the rule index (code invalid-regex:N) and the page shows "Invalid regular expression (rule N)". Pasted lines also require a => / -> / tab separator (invalid-rule:N) and a non-empty find side (empty-find:N). Disabled rules (leading !) are still validated so a typo cannot hide until the next run.

What is the quickest way to paste rules?

One rule per line as "find => replace" (also -> or a tab). A leading ! disables the line, a find side written as /regex/i is a regular expression, \n \t \\ are unescaped to newline / tab / backslash, and lines starting with # are comments. Pasted rules run first, rules added in the list below run afterwards.

Keywords:multi replaceregex replacetxt-item-replace

Related tools