Replace spaces with colon (:) in Notepad++

notepadregex

Suppose (this is sample data) I have these lines:

A                          W
BAKER                      X
CANDLESTICKMAKER           Y
DOGCATCHER                 Z

I want to change the whitespace to colons, like this:

A:W
BAKER:X
CANDLESTICKMAKER:Y
DOGCATCHER:Z

How can I achieve this in Notepad++?

Best Answer

Replace + ( followed by +) with ::

enter image description here

Make sure Regular expression is checked.

As igalvez pointed out in his comment, you might want to use ( |\t)+ to also match \t (the tab character).

One might want to use \s to match all whitespace, but that will also match the line breaks and condense your whole data to a single line.

Related Question