How to Use Textslave's Whitespaces & Tabs Tool to Replace Multiple Spaces or Tabs

Updated

Open Textslave and scroll to the Whitespaces & Tabs section. It contains two separate operations: Replace multiple whitespaces and Replace tab. Each has its own replacement input box, its own Preview button, and its own Save button. To collapse runs of spaces into one space, enter a single space in the "Replace multiple whitespaces with" field and click Preview. To convert tab characters to something else, enter the target character or string in the "Replace tabs with" field and preview the result. Nothing is applied to your text until you click Save, so you can inspect the output first.

Replace multiple whitespaces

This operation targets consecutive whitespace characters and replaces the whole run with the string you supply.

  1. Paste or type your text into the Textslave input area.
  2. In Whitespaces & Tabs, find Replace multiple whitespaces.
  3. Type the replacement into the field labelled "Replace multiple whitespaces with". A single space is the usual choice when you want to normalise spacing.
  4. Click Preview to see the transformed text.
  5. If the result looks right, click Save to keep it.

The practical effect: a line like Name: John Smith becomes Name: John Smith when you replace with one space. Runs of spaces, and mixed runs of spaces and tabs, are treated as a single block and replaced once.

Choosing the replacement value

Goal What to enter in the replacement field
Collapse any run of whitespace to one space a single space
Remove extra whitespace entirely leave the field empty, if the tool accepts an empty replacement
Use a visible marker while checking a character such as `

Preview first when you use an empty or unusual replacement, because the result can be hard to reverse by eye.

Replace tab

This is a separate operation from the whitespace collapse. It finds tab characters and substitutes the string you provide.

  1. Locate Replace tab in the same section.
  2. Enter the replacement in the "Replace tabs with" field — for example a single space, a comma, or a pipe character.
  3. Click Preview.
  4. Click Save when satisfied.

Use this when your text came from a spreadsheet or a fixed-width source and you want tab-separated columns turned into something readable, such as comma-separated values. If your text mixes tabs and spaces and you want everything normalised, run Replace tab first (converting tabs to spaces), then run Replace multiple whitespaces to collapse the resulting runs.

Filtering which lines are processed with advanced options

Both operations include an Use advanced options control. It lets you restrict the change to certain lines instead of the whole text. The available line conditions are:

  • lines equal to a string
  • lines different from a string
  • lines containing a string
  • lines lacking a string

You also choose where the string must appear: everywhere, at the start, or at the end.

For example, if only header rows contain a tab you want converted, set the condition to lines containing the header text, choose at the start, then run Replace tab. Lines that do not match are left untouched. This is the main safeguard against a global replace damaging parts of the text you meant to keep.

Verify before you save

Preview is the verification step. Compare the preview against the original for:

  • lines where spacing carried meaning, such as indented code or aligned columns
  • blank lines, which may disappear if they consisted only of spaces
  • the boundaries of your filter, to confirm only intended lines changed

If the preview is wrong, adjust the replacement string or the advanced options and preview again. Save commits the result.

Common snags

  • Indentation lost. Collapsing whitespace destroys leading indentation. If the text is code or an outline, filter to specific lines or skip this operation.
  • Tabs converted but spaces remain. Run Replace tab before Replace multiple whitespaces, not after.
  • Nothing changed. Check whether advanced options are active with a condition that matches no lines, and check that the replacement field is not identical to what is being replaced.
  • Empty replacement behaves unexpectedly. Preview an empty replacement carefully; some tools treat it as "delete the match" and others ignore it.

Before you start

Keep a copy of the original text. These operations are one-way in the editing session, and a broad replace can remove formatting you did not notice until later. Paste into a scratch document first if the text is important, and only apply Save to the copy you are willing to change.