About Find and Replace Text
Find and replace online means swapping every copy of a word, phrase or pattern in a block of text for something else. This tool is free, needs no sign-up and runs in your browser, so the text you paste is never uploaded.
Type what to find and what to put in its place, and the Result updates as you go, with the number of replacements. You can match the case or ignore it, match whole words only, replace the first match or all of them, and switch to a regular expression for patterns. Add more rules and they run in order.
Three one-click cleanups sit under the rules: remove line breaks, remove extra spaces and remove duplicate lines. They run after your rules, so you can replace words and tidy the layout in one pass.
How to use Find and Replace Text
- Paste your text into the Text box.
- Type the text to look for in Find and its replacement in Replace with. The Result below shows the new text and says how many replacements were made.
- Tick Case sensitive, Whole word, or Regex as needed. Untick Replace all to change only the first match.
- Press Add rule to run several replacements in order. Each rule works on the output of the one before it.
- Tick Remove line breaks, Remove extra spaces or Remove duplicate lines for a cleanup. Then Copy, Download .txt, or Move to input to work on the result.
Features
- Plain text or regular expression (JavaScript syntax) rules.
- Case sensitive and Whole word options, and Replace all or first match only.
- Regex options for multiline (^ and $ match at each line) and dot matches newline.
- Capture groups in the replacement: $1, $2, $&, $$ and named $<name>.
- Several rules in one pass, applied in order, with a replacement count for each.
- Cleanups for line breaks, extra spaces and duplicate lines.
- A clear message when a regular expression is invalid, instead of a crash.
- Move to input, Undo, Copy and Download .txt.
Worked examples
Find "colour", replace "color", in: Colour, colour, COLOURFUL gives color, color, colorFUL (3 replaced)
Matching ignores case by default and does not look at word boundaries, so "COLOURFUL" changes too.
The same rule with Whole word on, in: Colour, colour, colourful gives color, color, colourful (2 replaced)
Whole word leaves "colourful" alone.
Regex (\w+)@(\w+)\.com replaced by $2: $1, in: [email protected], [email protected] gives acme: ann, zeta: bob (2 replaced)
$1 and $2 are the first and second capture groups.
Replacement symbols in regex mode
| Write | You get |
|---|---|
| $1, $2 ... $99 | The text matched by that capture group |
| $& | The whole match |
| $<name> | The text matched by a named group (?<name>...) |
| $$ | A literal dollar sign |
Options
| Option | What it does | Default |
|---|---|---|
| Regex | Reads Find as a regular expression | Off |
| Case sensitive | Capitals must match exactly | Off |
| Whole word | Matches only whole words, not parts of longer words | Off |
| Replace all | Replaces every match, or only the first when off | On |
| Multiline | Regex only: ^ and $ match at the start and end of each line | Off |
| Dot matches newline | Regex only: the dot also matches a line break | Off |
Good to know
Plain text versus regular expressions
In plain mode what you type in Find is matched exactly, symbols included, so a dot or a bracket means itself. The Replace with text is inserted exactly as typed, so "$1" stays "$1".
In Regex mode Find is a JavaScript regular expression, so a dot matches any character, \d matches a digit and (...) captures a group. Special symbols need a backslash to mean themselves. If the pattern is not valid, the rule shows "Invalid regular expression." and does nothing.
How rules and cleanups combine
Rules run from the first to the last, and each one sees the result of the one before. Swapping two words needs care: replacing "red" with "green" and then "green" with "red" turns everything into "red". Use a pattern with groups, or a temporary word, for swaps.
Cleanups run after all the rules, in this order: remove duplicate lines, remove extra spaces, remove line breaks. A rule with an empty Find is skipped.
Privacy: how it works
- The replacing runs in your browser tab. Your text is not sent to Ulkaa or to any other server.
- This tool does not save your text. Close or reload the page and it is gone.
Tips
- Turn on Whole word when you replace short words, or "cat" will also change "category".
- Test a regex on a small piece of text before you run it on a long one. The count tells you whether it matched what you expected.
- Use Move to input to continue from the result, and Undo if a step went wrong.
- Keep a copy of the original text. This tool does not save it for you.
Frequently asked questions
Is it really free?
Yes. There is no price, no trial and no credit card. Ulkaa Tool does the work with your own device, so there is no server bill to pass on to you.
Do I need an account?
No. There is no sign-up and no login. Open the page and use it. An Ulkaa account is not needed for anything on this tool.
Does it run in my browser?
Yes. Your text are processed by code running in your browser tab, on your own device.
Is my data uploaded?
No. Your text are never sent to Ulkaa or to anyone else. You can check this yourself by watching the Network tab in your browser developer tools while you use the tool.
How do I replace text in bulk?
Paste the text, type the word in Find and its replacement in Replace with, and keep Replace all on. Every match changes at once, and the Result says how many.
Is the find and replace case sensitive?
Not by default. Tick Case sensitive to make capitals matter, so that "US" and "us" are different.
How do I use regex to replace text?
Tick Regex, then write a JavaScript regular expression in Find. Use $1, $2 and so on in Replace with to reuse the parts you captured.
How do I replace several words at once?
Press Add rule and give each word its own Find and Replace with. The rules run in order, and each shows its own count.
How do I remove line breaks or extra spaces?
Tick Remove line breaks to join all lines with a single space, or Remove extra spaces to collapse runs of spaces and tabs and trim each line. The Remove line breaks, Remove extra spaces and Remove duplicate lines pages start with those ticked.
What regex flavour does it use?
JavaScript regular expressions, as in your browser. Features that exist in other tools, such as possessive quantifiers or inline modifiers, may not work.
Can I undo a replacement?
The original text stays in the Text box until you press Move to input. After that, Undo puts the earlier text back.
Popular Find and Replace Text pages
- Find and ReplaceReplace every copy of a word or phrase in your text at once.
- Regex ReplaceReplace text by pattern, with capture groups, in your browser.
- Remove Line BreaksJoin your text into one line by removing every line break.
- Remove Extra SpacesCollapse double spaces and trim every line.
- Remove Duplicate LinesKeep the first copy of each line and drop the repeats.
- Replace Multiple Words at OnceRun several find and replace rules on your text in one go.