Text Find & Replace
Find and replace text across multi-line input. Supports case-sensitive search and regex.
Input
Output
Replacements: 0Characters: 0
Find and replace text online
Paste any multi-line text, type your search string or regex pattern, and set the replacement. Toggle case-sensitive matching and regex mode independently. With "Replace all" enabled, every match is replaced at once. In plain-text mode the replacement is inserted exactly as typed, so a $ stays a dollar sign; in regex mode $1 and $& become back-references. Useful for bulk editing code, cleaning data, or transforming template text. For sorted output, try Text Sorter. To remove HTML tags, use Remove HTML Tags.
Built and maintained by Meet Shah · Last updated
What this tool is used for
- Renaming a term throughout a pasted block without an editor.
- Applying a regex substitution to a log extract.
- Normalising inconsistent spellings across a document.
- Stripping a repeated prefix from every line.
- Testing a replacement pattern before putting it in a script.
Frequently Asked Questions
- Is plain-text mode really literal?
- Yes, on both sides. Many tools escape the search pattern but hand the replacement straight to the language's replace function, where `$&`, `` $` `` and `$'` are substitution sigils — replacing with `$'` then silently splices the rest of the document in. Here the replacement is escaped too.
- When should I turn on regex mode?
- When you need a pattern rather than a string: optional parts, character classes, or capture groups. In regex mode `$1` and `$2` back-references in the replacement *are* expanded, which is the whole point — that is the one difference between the two modes.
- Does whole-word matching work on accented words?
- Yes. A plain `\b` is defined over `[A-Za-z0-9_]`, so it treats é as a boundary and matches inside "café". The word boundaries here are Unicode-aware, which is why searching for "cafe" does not match inside "café".
- How do I replace across multiple lines?
- In plain mode, paste the multi-line text into the search box as-is. In regex mode, remember that `.` does not match a newline — use `[\s\S]` for "any character including newlines", which is the portable idiom.
- Why is nothing being replaced?
- Almost always invisible characters. Text copied from a PDF or a web page often carries non-breaking spaces (U+00A0) that look identical to spaces, or smart quotes where you typed straight ones. Check with a code-point inspector before assuming the search is wrong.
- Why does replacing a word also change it inside other words?
- Because a plain substring match has no notion of word boundaries — replacing `art` also hits `start` and `party`. Matching with `\b` on either side is what limits it to whole words.
Common errors and gotchas
- Forgetting to escape regex metacharacters, so a dot matches every character.
- Replacing only the first match because the global flag was not set.
- Matching a substring inside a longer word where a word boundary was needed.
- Using a greedy quantifier that swallows everything between two delimiters.
- Replacing inside code or a URL where the match was structural rather than textual.
Related Text Tools tools
Case Converter
Convert between Sentence, Title, camelCase, snake_case, and more.
Word Counter
Count words, characters, and analyze keyword density.
Text to Binary
Convert text into its 8-bit binary representation.
Binary to Text
Decode 8-bit binary back into readable text.
Text Reverser
Reverse text by characters, words, or lines.
Remove Duplicate Lines
Delete repeated lines and keep your list unique.
Remove Empty Lines
Strip blank and whitespace-only lines from text.
Sort Lines Alphabetically
Sort lines A–Z or Z–A, case-sensitive or not.