๐Ÿ” Find and Replace

2 matches

Find a specific string within a block of text and replace every occurrence at once. Supports toggling case sensitivity, plus advanced pattern matching with regular expressions.

How to use

  1. Enter the text you want to search and replace within.
  2. Enter the text to find and the text to replace it with.
  3. Toggle "Case-sensitive" and "Use regex" as needed.
  4. The replaced result and match count appear automatically.

How the calculation works

This tool finds every part of the input that matches the search term and replaces it with the replacement text. Internally it searches with a JavaScript regular expression, always with the g flag so that every match is replaced. When matching is case-insensitive, the i flag is added too. With "Use regex" off, symbols in the search term such as . * ? ( ) [ ] are escaped and treated as plain characters. The replacement is also inserted exactly as typed, so text containing $, such as "$100", comes out unchanged. With regular expressions on, you can search with a pattern and refer to capture groups with $1, $2, and to the whole match with $&, in the replacement. The number of matches is counted before replacing and shown on screen.

Worked example

Normal mode Input: The quick brown fox jumps over the lazy fox. Find: fox Replace: cat Output: The quick brown cat jumps over the lazy cat. (2 matches) Regex mode (reordering a date) Input: 2026-09-18 Find: (\d+)-(\d+)-(\d+) Replace: $3/$2/$1 Output: 18/09/2026

Things to be aware of

  • In regex mode, ^ and $ match only the start and end of the whole text, not each line, and . does not match a newline.
  • If the pattern is not a valid regular expression (for example, an unclosed bracket), an error is shown and nothing is replaced.
  • To put a literal $ in the replacement in regex mode, type $$.
  • Every match is replaced at once. To replace only some occurrences, make the search term more specific.

FAQ

How are regex special characters handled?

With "Use regex" off, the search text is treated as a plain string, so regex special characters (. * + ? etc.) are matched literally. Turning it on interprets the search text as a regex pattern.

Can the replacement text reference the matched portion?

With "Use regex" on, you can use capture group references like $1 in the replacement text.

What happens if I enter an invalid regex?

An error message is shown and the original text is returned unchanged.