Simple trick to replace multiple spaces with single tab character

By | August 23, 2018

If you have data with multiple space characters and you wish you could replace all the multiple spaces with tab characters (I bet you want to paste it into Excel), here is a quick trick – Use RegEx.

  • If you don’t have Notepad++, download and install it.
  • Open the Notepad++ and paste the text into new document
  • Go to Search menu > Replace… (Shortcut Ctrl+R)
  • Paste or type “([ ]+)” (without quotes) in “Find what…” box
  • Paste or type “\t” (without quotes) in “Replace with…” box
  • Select “Regular expression” in “Search Mode” section.
    Notepad++ replace multiple spaces with tab character
  • Click “Find Next” button to make sure that it find the right text
  • Click “Replace” to make sure that it replaces it correctly. Use it multiple times before you click “Replace All”.
  • Once done, set the “Search Mode” to “Normal” again

 

Vishal Monpara is a full stack Solution Developer/Architect with 13 years of experience primarily using Microsoft stack. He is currently working in Retail industry and moving 1’s and 0’s from geographically dispersed hard disks to geographically dispersed user leveraging geographically dispersed team members.