Clean & Edit · Text tools

Find and Replace

Search and replace across your draft with plain text or regular expressions.

Replacements: 2

What is Find and Replace?

Find and Replace searches a text and replaces every match, with optional case-insensitive matching or JavaScript regular expressions. It also reports how many matches were found before replacement.

Plain mode treats the find text literally. Regex mode treats it as a JavaScript regular-expression pattern and allows replacement-string features such as capture references. Global matching is always enabled; turning off case sensitivity adds the `i` flag.

Why Use This Tool?

Bulk replacement is faster and more consistent than editing repeated names, terms, separators, or formatting patterns one by one.

  • Update repeated wording across a draft.
  • Normalize known labels or separators.
  • Use regex patterns for structured matches.
  • Confirm the number of matches before using the output.

How Does This Tool Work?

An empty find value returns the original text with zero replacements. Case-sensitive plain mode splits on the exact find string and rejoins with the replacement; the number of joins is the count. Case-insensitive plain mode repeatedly searches lowercased remaining text while copying slices from the original, so replacement text is inserted literally.

Regex mode constructs `new RegExp(find, "g")` or `new RegExp(find, "gi")`. It obtains the count with `text.match(regex)` and performs replacement with JavaScript `replace`. An invalid regex throws a syntax error unless the interface catches and displays it.

Understanding Your Results

Matches do not overlap. Replacements are not searched again during the same operation. Plain mode inserts `$&`, `$1`, and dollar signs literally, while regex mode interprets JavaScript replacement tokens. Case-insensitive behavior uses JavaScript case conversion and regex semantics, not locale-specific linguistic matching.

Regex count means the number of global matches. Zero-length patterns can match positions rather than visible characters, and advanced patterns can be slow on large or adversarial input. Only `g` and optional `i` flags are exposed; multiline, dotAll, and Unicode flags cannot be selected separately.

Why Tracking This Matters

A broad replacement can silently alter unintended text. Understanding literal versus regex mode, case rules, and replacement tokens helps keep batch edits controlled and reviewable.

Benefits of Using Find and Replace

  • Literal and regex modes
  • Optional case-insensitive matching
  • Global replacement
  • Replacement count
  • Useful for repeated editorial changes
  • Private browser execution

How Is the Result Calculated?

Count is the number of nonoverlapping matches found in the original input. Plain exact mode derives it from the number of split pieces minus one. Regex mode counts the global match array.

plain exact count = text.split(find).length − 1

Find
Literal text or JavaScript regex source.
Replacement
Literal plain-mode text or regex replacement template.

Tips for Better Results

  • Start with plain mode unless a pattern is necessary.
  • Test regex on a small sample before replacing a long document.
  • Escape regex metacharacters when they should be literal.
  • Review replacement counts and the resulting context.
  • Keep a copy of the original text for important edits.

Conclusion

Find and Replace supports quick literal edits and more powerful JavaScript regex replacements. Use the simplest mode that works, verify the count, and review broad edits before publishing.

Privacy & how it works

This text tool processes your input in the browser. Your text is not uploaded to The ToolSphere servers for this tool. Privacy Policy.

FAQ

Does the tool replace every match?expand_more

Yes. Matching is global in both plain and regex modes.

Are overlapping matches replaced?expand_more

No. JavaScript matching proceeds through nonoverlapping matches.

What happens when Find is empty?expand_more

The original text is returned with a replacement count of zero.

Which regex flags are used?expand_more

Global `g` is always used; case-insensitive mode adds `i`.

Can I use capture groups in replacement text?expand_more

Yes in regex mode, using JavaScript replacement syntax. Plain mode inserts those characters literally.

What happens with an invalid regex?expand_more

JavaScript cannot construct it, so the operation produces an error.

Are new replacements searched again?expand_more

No. Matching is based on the original text for that operation.

Can a regex be slow?expand_more

Yes. Some backtracking-heavy patterns can perform poorly, especially on large input.

Is this tool free?expand_more

Yes. No signup and no paywall for core use.

Is my text uploaded?expand_more

No for this tool. Text stays in your browser while you work.

Do I need an account?expand_more

No. Open the page and start typing or pasting.

Suggest an improvement

Tell us what would make this tool more useful. We read every suggestion.

Feedback for: Find and Replace