NHRepon
Home
Services
All ServicesWeb Application DevelopmentMobile Application DevelopmentDigital Marketing and SEO
ProjectsToolsProductsPostsAboutContactLogin
HomeServicesProjectsToolsProductsPostsAboutContact
  • Home
  • Projects
  • Posts
Home/Tools/Text Tools/Find and Replace
All Tools

Find and Replace

Replace text across a document with case, whole-word and regular-expression options, a cap on how many replacements are made, and a list of every match found.

In regex mode, $1 to $9 insert captured groups and $& the whole match.

A cap is useful when the first few occurrences are the ones you want changed and the rest are not: renaming the first mention of a term while leaving references alone.

A short guide to replacing safely

The reason to look at the match list before copying the result is that replacements go wrong in predictable ways. Whole-word matching is the difference between changing "cat" and quietly breaking "category". Case sensitivity decides whether a swap catches the sentence-initial capital. And a pattern that contains a full stop, a bracket or a question mark is a regular expression by accident unless it has been escaped, which the non-regex mode here does for you.

Regex mode is worth learning for a handful of jobs that are otherwise impossible: turning 2026-10-25 into 25/10/2026 with (\d{4})-(\d{2})-(\d{2}) and $3/$2/$1, splitting a list of firstname lastname the other way round, or removing blank lines with ^\s*$. Two cautions: JavaScript regular expressions have no lookbehind support below Safari 16.4, and a greedy .* will swallow far more than you intended if you do not make it lazy with .*?.

What does find and replace do?

Find and replace takes every occurrence of a pattern in a block of text and substitutes something else. The pattern can be a literal string, in which case the tool simply looks for those characters, or a regular expression, in which case it can describe a shape — any four digits followed by a hyphen and two more digits, say — and capture parts of what it matched so they can be rearranged in the replacement.

Two options decide most of the outcomes. Case sensitivity determines whether the search catches the sentence-initial capital as well as the lowercase form, which is the difference between a tidy replacement and a document with one stray unchanged word in every paragraph. Whole-word matching determines whether changing “cat” also quietly changes “category” — a mistake that is invisible in the preview and obvious only when somebody reads the text.

The match list above the result is the part that makes the operation safe. It shows every occurrence found, with the surrounding words, before you copy anything. Replacements go wrong in predictable ways: a greedy quantifier matching far more than intended, a pattern containing an unescaped full stop matching any character, or a stray space inside the search term that silently narrows it to nothing. Seeing the count and the first fifty matches turns all three from a silent corruption into an obvious one.

How to replace text with or without regular expressions

  1. Paste the text to edit into the first box.
  2. Type what you are looking for. In plain mode every character is literal, so punctuation needs no escaping.
  3. Type the replacement. In regex mode $1 through $9 insert captured groups and $& inserts the whole match.
  4. Decide on case sensitivity first — it is the cause of most surprising results — then whole-word matching if the search term is a substring of other words.
  5. Read the match list. If the matches are not the ones you meant, adjust the pattern rather than copying a wrong result.
  6. Set a cap if only the first few occurrences should change, then copy the result or press Apply and keep going to chain another replacement.

Find and Replace limits and rules

Limits, caps and standards referenced by this tool
ItemLimit
ModesLiteral text or a JavaScript regular expression
Flags availableGlobal always; case-insensitive unless Match case is ticked
Whole wordWraps a literal search in word boundaries; ignored in regex mode
Group references$1 to $9 and $& in regex mode
Replacement capAny number; 0 replaces every match
Match listThe first 200 matches are counted, the first 50 shown with context
Regex flavourThe browser's own — no lookbehind below Safari 16.4, no named groups in the capped branch
UndoUse Apply and keep going, or keep the original text in another window

When to use it

  • Renaming a product or a person across a long document without missing the sentence-initial capital.
  • Converting a date format throughout a spreadsheet export with a single pattern.
  • Stripping tracking parameters from a list of URLs by matching the query string.
  • Fixing a consistent typo — an unusual double space, a wrong apostrophe — across thousands of words.
  • Replacing only the first mention of a term while leaving later references as they were.

Is it private?

Everything happens in this page. The search, the substitution and the match list are all computed in JavaScript in your browser; the text is never uploaded and there is no server involved, no account and no stored history of what you pasted.

Frequently asked questions

Literal mode treats every character as itself: searching for “a.b” finds the three characters a, full stop, b and nothing else. Regex mode interprets special characters, so “a.b” matches a, then any single character, then b — which is usually not what somebody typing that string intends. The tool escapes your input automatically in literal mode, so switching to regex should be a deliberate decision rather than an accident.

Put parentheses around the part of the pattern you want to keep, then refer to it in the replacement as $1 for the first group, $2 for the second and so on. To turn 2026-10-25 into 25/10/2026, search for (\d{4})-(\d{2})-(\d{2}) and replace with $3/$2/$1. Groups are numbered from the left by the position of their opening parenthesis, including nested ones, and $& stands for the entire match including anything not captured.

Three causes cover almost all of it. A pattern without word boundaries matched a substring of a longer word. Case insensitivity was on when you wanted an exact match, or off when you did not. Or a quantifier was greedy — “.*” takes as much as it can, so a pattern meant to match within one line happily runs across the entire document; making it lazy with “.*?” stops at the first opportunity instead. The match list is there to show you which of the three happened before you commit.

Lookahead works everywhere; lookbehind does not, below Safari 16.4. That matters because a regular expression is parsed when the script loads, so a pattern containing an unsupported construct does not merely fail — it can stop the page from running at all. This tool builds the pattern from your input at the moment you type it, inside a try/catch, so an unsupported construct is reported as an invalid pattern instead of breaking the page.

Yes, but only in regex mode and only deliberately. The search term can contain newlines if you paste them, and “\n” in a pattern matches a line break. The common mistake is “.*”, which does not match newlines by default in JavaScript — so a pattern meant to span lines quietly fails, or, if the text has been joined into one line, matches far too much. Being explicit about where line breaks are allowed is the reliable approach.

Not automatically — there is no undo stack beyond your browser's own form history. The Apply and keep going button overwrites the input with the result, which is convenient and irreversible, so keep the original in another tab if the text is valuable. For anything you cannot retype, run the replacement on a copy and compare the two with the text diff tool before pasting anywhere important.

Related tools

  • Regex Tester
  • Text Diff Checker
  • Remove Line Breaks
  • Text Sorter
  • Remove Duplicate Lines

Written and maintained by Md. Nur Hossain Repon.

NHRepon


Md. Nur Hossain Repon expert in NextJS, React, React Native and Flutter. He is a full-stack web and mobile application developer with 5+ years of experience and a passion for building innovative and robust application. Also, he has a strong background in developing high-quality web and mobile applications using the latest technologies and frameworks.
Let's build something amazing together 🚀

Quick Links


  • About
  • Projects
  • Services
  • Contact
  • Posts
  • Products
  • Privacy Policy
  • Terms of Service
  • Tools
  • Smart Life Hubs

Newsletter


We respect your privacy. Unsubscribe anytime.

Connect


© 2026 NHRepon. All rights reserved.

Build v1.5.4+56.73c4a90