Skip to main content
ToolsHub

Find and Replace Text

Replace all occurrences of any text instantly. Supports regex patterns, case sensitivity, and whole-word matching. See match count and replacements made.

Updated

Files never leave your browser

No result yet

Enter text and a find term, then run Replace All or Replace Next to see the result here.

How to use Find and Replace Text

The Find & Replace tool performs bulk search-and-replace operations on any block of text, with support for literal string matching, case-insensitive matching and full regular expression patterns. It shows a live preview of every match before applying changes, displays a replacement count, and handles multi-line text and Unicode characters correctly — making it ideal for bulk editing data exports, template files and large documents without opening an IDE.

  1. Paste the text you want to edit into the main text area.
  2. Enter the search string (or regex pattern) in the "Find" field.
  3. Enter the replacement string in the "Replace" field (use $1, $2 etc. for captured groups in regex mode).
  4. Toggle "Case sensitive", "Whole word" and "Use regex" options as needed.
  5. All matches are highlighted in the text area; the match count is shown above.
  6. Click "Replace All" to apply all replacements, or use "Replace Next" to step through them one at a time.

Your data never leaves your device — 100% private processing.

Regex replace patterns and back-references

When using regex mode, the replacement string can reference captured groups from the search pattern. A capture group is a portion of the pattern wrapped in parentheses. In most replacement engines (JavaScript, Python re.sub, sed), $1 or \1 inserts the text matched by the first capture group, $2 the second, and so on. Named groups (?<year>\d{4}) can be referenced as $<year>. For example, the pattern (\w+)\s(\w+) with replacement $2 $1 swaps two space-separated words. The special replacement $& inserts the entire matched string, useful for wrapping matches in markup.

Common bulk-editing use cases

Find & Replace is most powerful for repetitive transformations across large texts. Common tasks include: updating a domain name across hundreds of URLs (find https://old-domain.com, replace with https://new-domain.com); reformatting dates from MM/DD/YYYY to YYYY-MM-DD using a capturing regex; stripping HTML tags from copied web content; converting Windows line endings (\r\n) to Unix line endings (\n); replacing smart/curly quotes with straight ASCII quotes in code or CSV files; and normalising phone number formats across a contact list.

Common find-and-replace patterns
TaskFind (regex)Replace
Swap date MM/DD/YYYY → YYYY-MM-DD(\d{2})/(\d{2})/(\d{4})$3-$1-$2
Strip HTML tags<[^>]+>
Collapse multiple spaces\s{2,}
Convert CRLF to LF\r\n\n
Remove blank lines^\s*$\n
Wrap numbers in brackets(\d+)[$1]

Worked examples

Reformat dates

Inputs: find (\d{2})/(\d{2})/(\d{4}) · replace $3-$1-$2

Result: 12/31/2025 → 2025-12-31

Strip HTML tags

Inputs: find <[^>]+> · replace with empty

Result: <p>Hi</p> → Hi

Collapse spaces

Inputs: find \s{2,} · replace with single space

Result: "a b" → "a b"

Glossary

Back-reference
A replacement token ($1, \1) that inserts the text matched by a capture group into the replacement string.
Whole word match
A search mode that only matches the pattern when it appears as a complete word, bounded by non-word characters.
Greedy match
A regex quantifier behaviour that matches as many characters as possible, which can cause unintended over-matching.
Non-greedy (lazy)
A regex quantifier (*?, +?) that matches as few characters as possible, useful in HTML tag patterns.
Global flag
The g regex flag that causes a pattern to match all occurrences rather than stopping at the first.

Related reading

Free · No spam

Get weekly tool tips & updates

New tools, power-user tips, and productivity hacks — delivered free every Friday.

No spam, ever. Unsubscribe with one click.

Related Text Tools

Explore all Text Tools.