Text Manipulation Tricks Every Writer Should Know
Most text cleanup comes down to four moves: join broken lines, find and replace, sort lines and fix capitalization. Done in the right order, they turn messy copied text into clean copy in minutes.
Published · Updated
Text manipulation means applying one rule to a whole text instead of editing it word by word. For writers, four rules cover most of the work: remove unwanted line breaks, find and replace, sort lines, and set capitalization. The seven tricks below show each one with real before-and-after output from the tools on this site, plus the settings that keep them from damaging your text.
1. Rejoin text copied from a PDF
A PDF stores each printed line separately, so copied text arrives with a line break at the end of every line, often in mid-sentence. Paste it into Remove Line Breaks and choose A space, keep paragraphs (the default). Single line breaks become spaces, and a blank line is kept as a paragraph break.
If the PDF hyphenated words at the end of lines, also tick Rejoin words split by a hyphen at the end of a line (PDF):
Before:
Words can be hyph-
enated across lines too.
After (option on):
Words can be hyphenated across lines too.
After (option off):
Words can be hyph- enated across lines too.
The option only joins a lowercase letter, a hyphen, a line break and another lowercase letter. That protects “Covid-19” split across lines (the digit does not match), but a real compound split at the hyphen, such as “well-” and “known”, becomes “wellknown”. The status line under the result says how many hyphenated words were joined, so you know how many to check; search the result for compounds you know the text uses. The guide on fixing line breaks in PDF text covers columns, footnotes and page numbers.
The other modes in the Replace line breaks with setting:
| Mode | Input “one / two / (blank) / three” becomes |
|---|---|
| A space | one two three |
| A space, keep paragraphs | one two, then a blank line, then three |
| Nothing | onetwothree |
| Custom text (“, “) | one, two, three |
2. Turn a column into a comma list, and back
Lists copied from a spreadsheet column have one item per line. To use them in a sentence or a form field, pick Custom text in Remove Line Breaks. With the default “, “ the lines apples, oranges and pears become:
apples, oranges, pears
Custom mode trims each line and drops empty lines, so stray blank rows at the end of the column do not leave a trailing comma.
To go the other way, use Replace Text: find ; (or , ), replace with \n, and tick Use \n and \t for line breaks and tabs (in Find and Replace with). “Item one; item two; item three” becomes three lines:
Item one
item two
item three
3. Find and replace without breaking other words
A plain search for “cat” also finds “category” and “concatenate”. Replace Text has two options that prevent that:
- Whole words only (on by default) stops a match that starts or ends with a letter, digit or underscore from touching another letter, digit or underscore. Searches that start and end with punctuation or a space, such as
;, are not affected. - Match case (off by default) makes “Color” and “color” different searches.
Here is the tool’s own sample, replacing “color” with “colour”:
| Settings | Result | Replacements |
|---|---|---|
| Whole words only on | The colour of the sky changes. Colors fade at dusk, but the colour returns at dawn. | 2 |
| Whole words only off | The colour of the sky changes. colours fade at dusk, but the colour returns at dawn. | 3 |
The second row shows the catch: the replacement is inserted exactly as you typed it, so “Colors” at the start of a sentence became lowercase “colours”. When the word can appear capitalized, run two passes with Match case on, one for “color” and one for “Color”, or fix the capital letters afterward. The tool shows the number of replacements under the result, which is a quick way to catch a search that matched more or less than you expected.
4. Use regular expressions for repetitive edits
Tick Regular expression ($1 for groups) when the text to change follows a pattern instead of being one fixed word. Parentheses in the pattern capture part of the match, and $1, $2 in the replacement put those parts back, the same capturing-group behavior described in MDN’s JavaScript documentation. All three patterns below give the same result with Whole words only on or off, because the option only checks the edges of a match that starts or ends with a letter or digit.
| Task | Find | Replace with | Before | After |
|---|---|---|---|---|
| Swap “Last, First” | (\p{L}+), (\p{L}+) |
$2 $1 |
Smith, Jane | Jane Smith |
| Dates to ISO format | (\d{2})/(\d{2})/(\d{4}) |
$3-$1-$2 |
10/21/2026 | 2026-10-21 |
| Collapse repeated spaces | {2,} |
a single space | First sentence.␣␣Second | First sentence. Second |
\p{L} means any letter, including accented ones, so “Okafor, Ada” and “Peña, José” work as well. For the space cleanup alone, Remove Extra Spaces does it without a pattern and also handles tabs and non-breaking spaces.
5. Sort lists the way people expect
Sort Lines puts one item per line in order. The default Alphabetical (A–Z) compares lines the way a dictionary does, ignoring case unless you tick Case-sensitive (Apple before apple; keep both when removing duplicates). Its weak spot is numbers: they are compared digit by digit, so “10” comes before “2”. Natural (2 before 10) reads runs of digits as numbers, the numeric collation option MDN documents for Intl.Collator:
| Alphabetical | Natural |
|---|---|
| Chapter 1 | Chapter 1 |
| Chapter 10 | Chapter 2 |
| Chapter 2 | Chapter 10 |
Three options are worth knowing for real lists:
- Ignore leading quotes, bullets and symbols sorts
- apple,* Mangoand"Zebra" quoteby apple, Mango and Zebra instead of by the symbols. - Remove empty lines (on by default) drops blank lines before sorting.
- Remove duplicates keeps the first spelling it meets, compared without case. The tool’s sample list (banana, Apple, cherry, apple, Date 10, date 2, Banana, elderberry) sorted naturally with duplicates removed gives Apple, banana, cherry, date 2, Date 10, elderberry.
Writers use this for glossaries, reference lists, cast lists and tag lists. The guide on how to alphabetize a list covers sorting by last name and ignoring “The”.
6. Make every heading follow one capitalization style
Headings drafted over several weeks drift between styles. Paste them all, one per line, into Title Case and pick a Style guide: AP, APA 7th, Chicago 18th, MLA 9th or Capitalize every word. Each line is converted separately, and the first heading is shown in all four styles so you can compare them. The styles differ mainly on short words such as prepositions:
| Style setting | “a walk through the woods with my dog” |
|---|---|
| AP | A Walk Through the Woods With My Dog |
| APA 7th | A Walk Through the Woods With My Dog |
| Chicago 18th | A Walk Through the Woods with My Dog |
| MLA 9th | A Walk through the Woods with My Dog |
| Capitalize every word | A Walk Through The Woods With My Dog |
Text typed in all capitals is handled too: “HOW TO WRITE A BOOK IN 30 DAYS” becomes “How to Write a Book in 30 Days” in APA. With Keep acronyms and brand names (NASA, iPhone) on, words with deliberate mixed capitals survive: “the NASA guide to the iPhone of rockets” becomes “The NASA Guide to the iPhone of Rockets”. For the rules behind each style, read title case rules; if your publication uses sentence-style headings, use Sentence Case instead.
7. Run the tricks in a sensible order
Order matters, because each step changes what the next one sees:
- Join lines first. Sorting or replacing text that still has a break in every line works on fragments, not sentences.
- Clean spaces so that searches for “two words” are not missed because of a double space.
- Find and replace, narrow searches first (whole words, match case), with an eye on the replacement count.
- Sort and remove duplicates once the items are spelled consistently, so “e-mail” and “email” do not survive as two entries.
- Fix capitalization last, because replacements can introduce lowercase words at the start of headings.
Before you paste the result back into your document, keep the original and compare the two versions, or at least reread the parts where a replacement ran. Bulk edits are fast in both directions: one careless pattern changes every match at once.
Questions
What is text manipulation?
Changing text in bulk with rules instead of by hand, such as joining lines, replacing words, sorting lists or changing capitalization. Each trick in this guide is one rule applied to the whole text at once.
Do these tools upload my text?
No. All four tools run in your browser, so the text you paste is processed on your own device.
Why did "Colors" not change when I replaced "color"?
With "Whole words only" on, "color" does not match inside "Colors", because the "s" makes it a different word. Turn the option off to match the letters anywhere, but check the result, because the replacement is inserted exactly as typed and does not copy the capital letter of the original.
Can I undo a change?
Each result appears in a separate output box, so your input stays as you pasted it. Keep a copy of the original anyway, and paste both versions into the text compare tool to see every change before you use the result.
Sources
- MDN Web Docs, Groups and backreferences, https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_expressions/Groups_and_backreferences (checked 2026-10-21)
- MDN Web Docs, Intl.Collator() constructor (numeric option), https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Collator/Collator (checked 2026-10-21)