5

The futurize automatically added some line into my codebase. Most of the time is on the first line.

from builtins import object

I would like to delete that line completely. So something like this

from builtins import object
import logging

will become

import logging

I have tried to use \b, that doesn't seem to work.

Brett Cannon
  • 14,438
  • 3
  • 45
  • 40
Jerry
  • 1,704
  • 5
  • 20
  • 40
  • Do you mean with just the keyboard? I use the plugin IntelliJ Keyboard Bindings. Then I use command + delete on Mac, or Ctrl + Delete on Windows. – Brant Unger Dec 02 '19 at 15:06
  • Sorry, I meant to ask how to do that in search and replace – Jerry Dec 02 '19 at 15:07
  • Does this answer your question? [Multiline regular expression search in Visual Studio Code](https://stackoverflow.com/questions/52647894/multiline-regular-expression-search-in-visual-studio-code) – Mrkinix Dec 02 '19 at 15:19

2 Answers2

8

In order to remove completely a line in VS Code through "Search and replace" you need to enable the RegExp function, then you type the line you want to remove followed by a "\n" and you leave the Replace field empty.

enter image description here

4

In addition to @Mattia's answer:

Alternatively you can use SHIFT + ENTER (instead \n) without enabling the regexp.

enter image description here

Narek Ghazaryan
  • 2,758
  • 1
  • 7
  • 11