Find and Replace

Advanced find and replace tool with regex support, case-sensitive search, whole word matching, preserve case option, and batch replacement. Find and replace text efficiently.

clearClearpastePaste
Search Options
Regular Expression Quick Reference

. - Any character

^ - Start of line

$ - End of line

\d - Any digit (0-9)

\w - Any word character (a-z, A-Z, 0-9, _)

\s - Any whitespace character

* - Zero or more times

+ - One or more times

? - Optional (zero or one time)

[abc] - Any character in set

About Find and Replace Tool

The Find and Replace tool is a powerful text search and replacement utility with advanced features including regular expression support, case-sensitive and case-insensitive search, whole word matching, preserve case option for smart replacement, and both batch (replace all) and step-by-step (replace next) replacement modes. The tool highlights matches in the output for easy verification and provides real-time statistics including match count, replacements made, and current position. Perfect for text editing, data cleanup, code refactoring, content migration, and batch text processing tasks.

What is the difference between Replace All and Replace Next?

Replace All instantly replaces every occurrence of the search text in one action, while Replace Next replaces matches one at a time, allowing you to review and selectively replace each match. Use Replace All for batch operations and Replace Next when you need more control over individual replacements.

How do I use regular expressions (regex)?

Enable the 'Use regular expressions' option and enter a regex pattern in the Find field. For example, '\d+' finds any sequence of digits, '[A-Z]\w+' finds words starting with capital letters, and '^\s+' finds leading whitespace. The tool includes a quick reference guide for common regex patterns.

What does 'Preserve case' do?

When enabled, the replacement text will match the case pattern of the original text. For example, if you replace 'hello' with 'goodbye', it will replace 'Hello' with 'Goodbye' and 'HELLO' with 'GOODBYE', preserving the original capitalization pattern. This only works with non-regex searches.

What is 'Match whole word only'?

This option ensures matches occur only as complete words, not as parts of other words. For example, searching for 'cat' with this option enabled will match 'The cat ran' but not 'category' or 'scatter'. It uses word boundaries (\b) in the search pattern.

How does the highlight feature work?

When 'Highlight matches' is enabled and you click Find, the output will show your text with matches marked like 【1:match】, 【2:match】, etc. This helps you verify what will be replaced before committing to the replacement. The numbers indicate match positions.

Can I search across multiple lines?

Yes! Enable 'Multiline mode' to make the ^ and $ regex anchors match at line breaks, not just the start/end of the entire text. This is useful for regex patterns that need to match patterns at the beginning or end of individual lines within your text.

Example Find and Replace Operations

FindReplaceOptionsResult
catdogCase sensitive: OFFChanges 'cat', 'Cat', 'CAT' to 'dog'
\d+NUMUse regex: ONReplaces all numbers with 'NUM'
theaWhole word: ONReplaces 'the' but not 'there' or 'other'
hellohiPreserve case: ONHello→Hi, HELLO→HI, hello→hi
^\s+Regex + Multiline: ONRemoves leading whitespace from each line