Skip to content
FileKit
Text And WritingRuns in your browser5 min read

Find and Replace Text

This find and replace text tool searches a block of text for every occurrence of a phrase or a pattern and swaps it for something else, in either plain text mode or full regular expression mode. Every match is counted and the result updates as you type, so you can see exactly how many replacements will happen before you commit to them.

Loading the tool interface
Files never leave your deviceNo upload wait and no queueNo signup, watermark or file limit

A basic find and replace, matching an exact phrase with optional case sensitivity and whole word matching, covers most everyday editing tasks: fixing a misspelled product name across a document, updating a changed URL throughout a file, or standardising inconsistent terminology. Regular expression mode covers everything beyond that, matching a pattern rather than a fixed string, such as every number in a document, every email address, or every line starting with a specific prefix.

The whole operation runs locally in your browser using the same regular expression engine built into JavaScript. No text is uploaded, so applying a bulk replacement to a confidential document or an unpublished draft is exactly as private as editing it by hand.

Plain text mode compared with regex mode

Plain text mode treats whatever you type in the find box as a literal string to search for, with no special characters, so searching for 3.14 finds exactly that sequence of characters rather than interpreting the dot as a wildcard. This is the right mode for the vast majority of find and replace tasks, where you know the exact text you are looking for.

Regex mode treats the find box as a regular expression pattern, unlocking matches that plain text cannot express: any sequence of digits, any word starting with a capital letter, any line ending in a specific character. It is more powerful and more precise, but a pattern with a small mistake can match far more or far less than intended, so the live replacement count is especially worth checking carefully before committing to a regex replacement.

Case sensitivity and whole word matching

Case sensitive find and replace, when enabled, only counts an exact case match as a hit, so searching for Apple will not match apple. Turning it off matches regardless of capitalisation in either the search term or the text, which is usually what you want when standardising terminology that has been typed inconsistently.

Whole word matching restricts a match to occurrences where the found text is not part of a larger word, so searching for cat with whole word matching on will match cat and cats will not be touched incorrectly if you are only replacing the standalone word, while searching without it would also match the cat inside category. This prevents the most common accidental replacement mistake, where a short search term matches unintended text buried inside longer words.

Reading the replacement count before committing

Above the result, this tool reports exactly how many matches were found and replaced. That number is worth checking every time, especially in regex mode, since a pattern that is broader than intended will show an unexpectedly high count, and a pattern that is too narrow will show zero or fewer than expected. Catching either case in the count is far cheaper than catching it after the replaced text has already been pasted somewhere else.

Common regex find and replace patterns

A handful of patterns cover most practical regex find and replace needs: \d+ matches any run of digits, useful for finding numbers regardless of how many there are. \s+ matches any run of whitespace, useful for collapsing multiple spaces. A pattern like [A-Z][a-z]+ matches any capitalised word. Capture groups, written with parentheses, let you reference part of the match in the replacement text using $1, $2 and so on, which is how you rearrange or wrap matched text rather than only deleting or substituting it outright.

How this find and replace text tool works

In plain text mode, the search term is escaped so any regular expression special characters it contains are treated literally, then wrapped in word boundary markers if whole word matching is enabled, and finally compiled into a JavaScript regular expression with the global flag so every occurrence is found rather than only the first. In regex mode, your pattern is compiled directly, giving you full control including capture groups and replacement references.

If a pattern is not valid, most often because of an unmatched bracket or parenthesis, the tool reports a clear error explaining that rather than silently failing or crashing, so you know immediately that the pattern needs a fix rather than assuming zero matches means nothing to replace.

How to find and replace text

  1. 1

    Paste your text

    Drop a text file or paste the text you want to search into the main input box.

  2. 2

    Enter what to find and what to replace it with

    Type the exact text or, in regex mode, a pattern in the find field, and the replacement text in the second field.

  3. 3

    Set the matching options

    Choose plain or regex mode, and toggle case sensitivity and whole word matching as needed.

  4. 4

    Replace and review the count

    Press replace to run the operation, check the reported match count, then copy or download the result.

Related tools worth bookmarking

Sources and further reading

Frequently asked questions

Common questions about the find and replace text.

Plain mode searches for the exact text you type, treating every character literally with no special meaning. Regex mode interprets the find field as a regular expression pattern, letting you match a category of text, such as any number or any capitalised word, rather than one fixed string, at the cost of needing correct regular expression syntax.

Yes. As a find and replace online tool, this runs entirely inside your browser using JavaScript's built in regular expression engine, so nothing you paste or drop in is ever transmitted to a server. You can confirm this by checking your browser's network activity while running a replacement, which shows no outgoing request carrying your text.

Without it, searching for a short term like cat also matches the same letters inside longer words such as category or concatenate, producing unintended replacements. Whole word matching restricts a match to occurrences where the search term stands on its own as a complete word, which is the setting to use whenever you are replacing a specific word rather than any occurrence of that character sequence.

Paste the entire document into the input box, whatever its length, set your find and replace terms and options, and press replace once. Every matching occurrence throughout the whole text is replaced in a single pass, with the total count reported, so there is no need to repeat the operation manually for each match.

The tool reports a clear error message explaining that the pattern could not be compiled, most commonly because of an unmatched bracket or parenthesis, rather than silently treating it as zero matches. Fix the syntax issue described in the error and the replacement will run normally once the pattern is valid.

Yes, in regex mode. Wrap part of your pattern in parentheses to create a capture group, then reference it in the replacement field using $1 for the first group, $2 for the second, and so on. This lets you rearrange or wrap matched text in the replacement rather than only substituting it with fixed text.