Find and Replace Text
Quickly find and replace words or patterns in your text.
Find
Replace with
Matches Found: 0
Replacements Made: 0
How to use Find and Replace Text
- 1
Paste your text
Enter or paste the document or code you want to edit into the text area.
- 2
Enter find and replace terms
Type the word or pattern to search for in the Find box and what it should become in the Replace with box, which can be left empty to delete matches.
- 3
Set matching options
Turn on Case Sensitive, Whole Word Only, or Use Regular Expression to control exactly which occurrences are matched.
- 4
Replace and copy
Click Replace All to apply the changes, check the matches and replacements count, then copy the result.
Mastering Find and Replace: Literal, Whole-Word, and Regex
Three options that change everything
Find and replace looks simple, but the three checkboxes, Case Sensitive, Whole Word Only, and Use Regular Expression, are what turn it from a blunt instrument into a precision tool. The default is a literal, case-insensitive search that replaces every occurrence of your term. Each option narrows or expands which occurrences match, so picking the right combination is the whole skill.
After every run, the tool reports the number of matches found and replacements made. Treat that count as your safety check: if you expected to change five names and the counter says fifty, your search was too broad, and you can adjust an option before the change goes anywhere it shouldn't.
Literal search and case sensitivity
By default the search is literal, meaning it looks for the exact characters you type, and it ignores case, so "color" matches "Color" and "COLOR" alike. That is ideal for quick, forgiving cleanups where capitalization varies. Replacing "teh" with "the" across a document is the classic example.
Turn on Case Sensitive when capitalization carries meaning. Searching for "US" with case sensitivity on will match the country abbreviation but skip the word "us," and replacing "id" without case sensitivity could wreck "ID," "Id," and "hidden" alike. Whenever a term doubles as a common word, case sensitivity is your first line of defense.
Whole Word Only prevents collateral damage
The most common find-and-replace disaster is matching your term inside a larger word. Search for "cat" without protection and you will also hit "category," "scatter," and "vacate." Whole Word Only fixes this by matching your term only when it stands alone, bounded by spaces or punctuation rather than buried in another word.
Use it whenever you are replacing a short word or a name that could appear as a fragment elsewhere. Renaming a variable called "sum" to "total" is safe with Whole Word Only on; without it, you could silently corrupt "summary" and "consume." The match counter makes the difference obvious before you commit.
Unlocking regular expressions
Enable Use Regular Expression to search by pattern instead of by exact text. Regex lets you match classes of characters, repetition, and positions. A pattern like \d+ matches any run of digits, \s+ matches any run of whitespace, and the anchors ^ and $ match the start and end of a line. This is how you find things that vary, not just things that are fixed.
Practical wins include collapsing multiple spaces into one by replacing \s+ with a single space, or stripping trailing spaces by matching a whitespace run anchored to the end of the line. If your pattern has a syntax error, the tool warns you with an invalid-expression message so you can fix it rather than getting a silent wrong result.
Capture groups for reformatting
Regex truly shines when you need to rearrange text, not just delete it. Capture groups, written with parentheses, remember parts of the match so you can reuse them in the replacement using backreferences like $1 and $2. This lets one pass transform structured data into a new shape.
For example, to flip "Last, First" into "First Last," match the pattern that captures the two names around the comma and replace with the second group, a space, then the first group. The same technique reformats dates, swaps key-value pairs, and wraps matched text in new characters, all in a single Replace All.
Deleting text and ordering your edits
Leaving the Replace with field empty turns find-and-replace into a remover: every match simply disappears. This is the fast way to strip unwanted characters, delete boilerplate phrases, or remove formatting markers from pasted text. Combine it with regex to delete patterns, such as removing all digits or all bracketed notes at once.
When you run several replacements in sequence, order matters. An early replacement can create or destroy text that a later one depends on. Plan the sequence so each step leaves the text in the state the next step expects, and watch the replacement counts to confirm each pass did what you intended before moving on.
Common mistakes to avoid
The top three mistakes are predictable. First, replacing a short word without Whole Word Only and shredding longer words. Second, forgetting Case Sensitive and changing text you meant to leave alone. Third, in regex mode, forgetting that characters like the period, asterisk, plus, parentheses, and brackets are special, so a literal period must be escaped as \. to avoid matching every character.
The cure for all three is the same: make one change, read the match and replacement counts, and verify the result before chaining the next edit. Because everything runs locally in your browser, you can experiment freely on sensitive documents and code without anything being uploaded.
Frequently asked questions
Does it support regular expressions?
How does Whole Word Only work?
Can I delete text instead of replacing it?
How do I know how many changes were made?
Is my text kept private?
Related tools
Keep going with these handy tools