# Find and replace

Replace words in text, with optional regex

Use it at https://www.quicktoolz.com/tools/find-and-replace. From QuickToolz.

Paste your text, enter what to find and what to replace it with, and every match changes at once, with a live count. Turn on Match case to treat capitals as different. Turn on Regular expression for patterns, such as swapping names with groups. Your text stays in your browser the whole time.

## How it works

Every copy of find becomes replace.

In normal mode, what you type is matched exactly, so a full stop means a full stop. In regex mode, it’s a pattern, and $1 in the replacement means the first group.

Patterns run in the background with a time limit, so a bad one can’t freeze the page.

Worked example: With Regular expression on, finding (\w+) (\w+) and replacing with $2 $1 turns “John Smith” into “Smith John”.

## Examples

| Find | Replace | Input | Result |
| --- | --- | --- | --- |
| cat | dog | cat cat | dog dog |
| \d+ | # | a1 b22 | a# b# |

## What this tool doesn't cover

- Regex uses the JavaScript flavour, which differs a little from others.

## Questions

### What is a regular expression?

A short pattern that describes text. For example, \d+ means one or more digits.

### Why did my pattern stop?

Some patterns take far too long to run. We stop them after a second, so try a simpler one.

### Is my text uploaded?

No. Everything happens in your browser, and your text isn’t saved or sent anywhere.

### How do I replace a word everywhere in a text?

Enter the word to find and its replacement, then replace all. You can choose whether capital letters must match.

### Can I remove a word?

Yes. Leave the replacement box empty, and every match is removed.

## Sources

- [MDN: Regular expressions](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_expressions)