Compare, replace, or filter text: which fixes the difference?
Choose between seeing what changed, changing every match, and keeping only the lines that match a pattern.
When two versions of a text disagree, there are three honest responses: inspect the difference, rewrite every occurrence, or narrow the text to matching lines. Each answers a different question, and using a replace tool to explore usually makes the comparison harder.
Compare when you do not yet know what changed
The comparison tool aligns two texts line by line and marks added, removed and unchanged lines. Use it before editing so you can see the scope of the change instead of trusting memory or a summary.
Replace when the change is known and global
Find and Replace rewrites literal text or a regular expression and reports how many matches it changed. Use it after the comparison identifies the pattern, and keep a copy because replacements are immediate and not versioned.
Filter when you need a subset, not an edit
Grep Text keeps or inverts lines matching a literal string or regular expression. Use it to pull matching log lines or exclude noise, remembering that filtering removes context rather than altering the lines it keeps.
Tools covered in this guide
- Text Comparison Tool
Compare two texts line by line and show added, removed and unchanged lines.
- Find and Replace Text
Replace every occurrence of text or a regex pattern, with a match count.
- Grep Text
Filter lines by literal text or a JavaScript regular expression, keeping or inverting matches.
Frequently asked questions about text differences
Can I replace using a regular expression?
Yes. The replace tool accepts a regex pattern and reports the match count, so you can confirm the pattern hit what you expected.
Does comparing ignore whitespace differences?
Comparison is line based, so trailing spaces can make lines look different. Clean whitespace first if padding is not part of the change you are studying.
Can grep show lines that do not match?
Yes. The inverter keeps everything except matches, which is useful for removing known noise from a log before reading it.
More guides
- Basic meta, Open Graph, or Twitter Card: which tags do you need?
- Bold, italic, cursive, or blackletter: which Unicode style?
- Canonical or hreflang: which duplicate problem are you fixing?
- Check, find, or build a palindrome?
- Clean messy text in the right order: spaces, duplicates, accents
- Crop or resize PDF pages before printing?