
Replace X and Y from regex with minimum and maximum number of spaces you want to replace. If you have a need to replace spaces which are X or more but less than or equal to Y, use the following regex for “Find what” box. () Regex to Replace X or More But Less Than or Equal to Y Spaces with Tab Character Under Edit menu, Line Operations, we have lot of good stuff to do things with lines, like 'Remove Empty Lines' but we dont have 'Remove Duplicate Lines', i have needed this option many times, so i did it on Excel. If you have a need to replace exactly 2 spaces, use following regex for “Find what” box. \t represents a single tab character Regex to Replace Exactly 2 Spaces with Tab Character So it says to find a 1 or sequence of multiple consecutive space characters Note that there is a space character in between. Square brackets represent individual characters within it to search for. Here is what Regex does in layman’s terms.

Use it multiple times before you click “Replace All”.

Open the Notepad++ and paste the text into new document.If you don’t have Notepad++, download and install it.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 in Notepad++.
