# Find and Replace

> Replace every occurrence of a word, phrase or pattern in a block of text. Turn on case-insensitive matching or enter a regular expression for advanced edits; the number of replacements is shown instantly.

- URL: https://wordcounter.pk/find-and-replace/
- Type: Interactive tool (runs in the browser; nothing is uploaded)
- Updated: 2026-10-15

## How to use the find and replace

1. Paste your text into the input box.
2. Enter the text to find and the replacement.
3. Tick case-insensitive or regular expression if needed.
4. Check the replacement count, then copy the result.

## Plain text and regular expressions

By default the search text is matched literally, so special characters such as . and ? are treated as ordinary characters. Tick **Regular expression** to use patterns: `\s+` matches runs of whitespace, `\d{3}` matches three digits, and `(\w+)@(\w+)` captures parts you can reuse with `$1` and `$2` in the replacement.

An invalid pattern shows an error instead of changing your text. Case-insensitive matching ignores capitalisation in the search.

## Editing tasks that suit it

- Swapping a term across a long document, such as replacing a company name.
- Removing a character, such as every comma, by leaving the replacement blank.
- Turning a list into a comma-separated line by replacing `\n` with `, `.
- Varying an over-used word identified with the [Word Frequency Counter](https://wordcounter.pk/word-frequency-counter/).

Afterwards, tidy spacing with [Remove Extra Spaces](https://wordcounter.pk/remove-extra-spaces/) and recount with the [Word Counter](https://wordcounter.pk/).

## Frequently asked questions

### Is the search case-sensitive?

By default yes. Tick case-insensitive to ignore case.

### Can I use capture groups?

Yes, with regular expressions: $1, $2 and so on in the replacement.

### Does it change the original?

No. The result appears in a separate box.

## Related

- [Remove Extra Spaces](https://wordcounter.pk/remove-extra-spaces/index.md): Collapse double spaces, trim lines and remove extra blank lines.
- [Remove Duplicate Lines](https://wordcounter.pk/remove-duplicate-lines/index.md): Delete repeated lines from a list; keeps the first occurrence.
- [Case Converter](https://wordcounter.pk/case-converter/index.md): Convert text to upper, lower, title, sentence, camel, snake and kebab case.
- [Remove Line Breaks](https://wordcounter.pk/remove-line-breaks/index.md): Join hard-wrapped lines into one continuous paragraph.
- [Sort Lines](https://wordcounter.pk/sort-lines/index.md): Sort a list A–Z, Z–A, by length, reversed or shuffled.
- [Reverse Text](https://wordcounter.pk/reverse-text/index.md): Reverse characters, words, each word or lines.
- [Add Line Numbers](https://wordcounter.pk/add-line-numbers/index.md): Prefix every line of text with a line number.
- [URL Slug Generator](https://wordcounter.pk/url-slug-generator/index.md): Convert titles to lowercase, hyphenated URL slugs; supports bulk lists.

## Images

- ![Find and Replace: Find and replace words or patterns, with regex and case options. (WordCounter.pk cover graphic)](https://wordcounter.pk/img/find-and-replace/find-and-replace-cover-1200.webp)
- ![How to use the find and replace: Paste your text into the input box.; Enter the text to find and the replacement.; Tick case-insensitive or regular expression if…](https://wordcounter.pk/img/find-and-replace/find-and-replace-how-it-works-1200.webp)
- ![Quick facts: Find and Replace: Is the search case-sensitive?; Can I use capture groups?; Does it change the original?](https://wordcounter.pk/img/find-and-replace/find-and-replace-reference-1200.webp)
- ![Map showing how Find and Replace connects to Text Tools, Remove Extra Spaces, Remove Duplicate Lines, Case Converter and more on WordCounter.pk](https://wordcounter.pk/img/find-and-replace/find-and-replace-related-tools-map-1200.webp)
- ![Quick answer card: Is the search case-sensitive? By default yes. Tick case-insensitive to ignore case.](https://wordcounter.pk/img/find-and-replace/find-and-replace-quick-answer-1200.webp)

