Find & Replace Tool
The Find & Replace Tool lets you search for specific text patterns and replace them instantly. It supports case-sensitive matching, whole-word filtering, and regular expressions for advanced text manipulation.
Paste your text, enter a search term and replacement, and see the result in real time. Toggle options for case sensitivity, whole-word matching, and regex mode to handle everything from simple substitutions to complex pattern transformations.
How it works
Plain-text search escapes special characters and uses standard string matching. Whole-word mode wraps the pattern in word-boundary anchors (\b). Regex mode passes the pattern directly to the JavaScript RegExp engine with global matching.
Use cases
- Batch-renaming variables or identifiers in code snippets
- Cleaning up formatting inconsistencies in copied text
- Replacing placeholder tokens in templates
- Using regex to reformat dates, phone numbers, or structured data
- Removing unwanted characters or whitespace patterns from text
Frequently asked questions
How do I replace all occurrences of a word in a text?
Paste your text, type the word in the search field and its replacement in the replace field, and every match is substituted in real time with global matching. The tool shows a match count so you can confirm how many substitutions were made. Enable the whole-word option if you want to avoid replacing the word inside longer words.
What does whole-word matching do?
Whole-word mode wraps your search pattern in word-boundary anchors (\b), so it only matches the term as a standalone word. For example, searching for 'cat' with whole-word enabled matches 'cat' but not 'category' or 'concatenate'. Without it, plain-text search matches the pattern anywhere it appears.
How do I use regular expressions in find and replace?
Turn on regex mode and your pattern is passed directly to the JavaScript RegExp engine with global matching. That enables patterns like \d{4}-\d{2}-\d{2} to match dates or \s+ to match runs of whitespace, and capture groups can be referenced in the replacement with $1, $2, and so on. In plain-text mode, special characters are escaped and treated literally instead.
Is the search case sensitive?
It is optional. With the case-sensitivity toggle off, 'Hello' and 'hello' are treated as the same match; with it on, only exact-case matches are replaced. The setting applies to plain-text, whole-word, and regex modes alike.
How do I remove extra spaces or unwanted characters from text?
Enable regex mode and search for a whitespace pattern such as [ ]{2,} or \s+ with a single space as the replacement to collapse repeated spaces. Similarly, you can strip a specific character everywhere by searching for it and leaving the replacement field empty. The live preview shows the cleaned result before you copy it.