Home > database >  how to replace multiple leading space, each space with a specific char, in vscode interactively?
how to replace multiple leading space, each space with a specific char, in vscode interactively?

Time:06-02

how to replace multiple leading space, each space with a specific char, in vscode? FROM:

abcd
 bcd
  cd
   d

TO:

abcd
_bcd
__cd
___d

CodePudding user response:

To do it "interactively":

Find: ^\s|(?<=_)\s
Replace: _

  1. Enter those find/replace in the Find widget first.
  2. Select the lines you want to work on.
  3. Enable the Find in Selection option on the Find widget.
  4. Ctrl Alt Enter will progressively add the underscores.

replace spaces with underscore

  • Related