Find & Replace

Find every occurrence of a word or pattern in your text and replace it, with optional case-sensitivity and regex.

find-and-replace.js

Paste in a block of text, type what you want to find and what to replace it with, and the tool updates the text instantly. Turn on case-sensitive matching when capitalisation matters, or switch on regex mode to use pattern matching for more advanced jobs, like removing all digits or matching flexible word patterns.

Plain find-and-replace versus regex mode

Plain mode treats your search term literally — searching for 'cat' only matches the exact characters c-a-t. Regex mode instead treats the search field as a pattern: searching for \\d+ matches any run of digits, [A-Z]{2,} matches any run of two or more uppercase letters, and so on. Regex is more powerful but also easier to get wrong, so it's worth testing on a small sample of text before running it against something you can't easily undo.

Why case sensitivity changes results more than people expect

With case-sensitivity off, searching for 'Apple' will also match 'apple' and 'APPLE' — useful when you don't know how a word was capitalised throughout a document, but risky if you only want to catch the proper noun 'Apple' the company, not the word 'apple' the fruit. Turning case-sensitivity on avoids over-matching in exactly that kind of situation.

Common regex patterns worth knowing

A few patterns cover most everyday needs: \\d+ matches one or more digits, \\s+ matches any run of whitespace, ^ and $ anchor a pattern to the start or end of a line, and a vertical bar like cat|dog matches either word. Even without deep regex knowledge, these building blocks handle the majority of real-world cleanup tasks like stripping all numbers from a pasted list or collapsing repeated spaces into one.

Why testing on a small sample first genuinely matters

A regex pattern that seems correct can still match more text than intended in ways that aren't obvious until you see the actual result — a pattern meant to match a specific word might also accidentally match that word as a substring inside a longer, unrelated word. Running a new pattern against a short paragraph first, checking the result carefully, and only then applying it to a full document avoids the frustration of a large replace operation going further than expected.

How to use it

  1. Paste your text into the main box.
  2. Type the text (or regex pattern) you want to find.
  3. Type the replacement text.
  4. Toggle case-sensitive or regex mode if needed, then click Replace All.

Common ways people use this tool

Cleaning up inconsistent terminology

Replace every instance of an old product name or spelling variant with the correct current one across a whole document.

Stripping unwanted characters

Use regex mode to remove all digits, extra punctuation, or specific symbols from pasted data in one pass.

Batch-editing pasted spreadsheet data

Standardise formatting — like changing every comma-separated value to a different delimiter — before pasting into another tool.

Tips for getting the best results

  • Test regex patterns on a short sample first, since a slightly wrong pattern can match more (or less) than you intend.
  • Turn on case-sensitive matching whenever you need to distinguish a proper noun from the same word used generically.
  • Remember that Replace All is a one-shot action on the visible text — keep a copy of your original if you might need to start over.
  • For simple literal replacements, leave regex mode off; special characters like '.' or '*' are treated as plain text by default, which avoids accidental pattern matching.

Frequently asked questions

What does regex mode do?

It treats your 'find' field as a JavaScript regular expression instead of plain text, letting you match patterns like \\d+ for numbers or word boundaries.

Is the replace case-sensitive by default?

No, by default matching ignores case. Turn on the case-sensitive toggle to match exact capitalisation.

Can I undo a replacement?

Yes — just re-paste your original text, since replacements only affect the text currently in the box, not any saved file.

Why did my regex pattern throw an error?

Regular expressions have specific syntax rules; an unclosed bracket or an invalid escape sequence will cause the tool to show a JavaScript error message explaining what's wrong.

Can I replace text with nothing to delete it?

Yes, leave the 'replace with' field empty and every match of your find pattern will be removed.

Does this support replacing across multiple lines differently?

The tool treats your pasted text as one continuous block; regex mode with the right pattern can still target line-specific content if you're comfortable writing that pattern.

Is there a limit on how much text I can paste?

No hard limit — very large documents may just take a fraction of a second longer to process.

Can I use find and replace to reformat phone numbers or dates?

Yes, with regex mode enabled — a pattern matching digits in a specific arrangement combined with a replacement template can reformat structured data like phone numbers or dates in bulk.

Does the tool warn me before making an irreversible change?

No, Replace All applies immediately without a confirmation prompt, so it's worth keeping a copy of your original text before running a replacement you're unsure about.