Jerry
Jerry

Reputation: 1812

How to remove a whole line in VS code search and replace?

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.

Upvotes: 6

Views: 7715

Answers (2)

Narek Ghazaryan
Narek Ghazaryan

Reputation: 3123

In addition to @Mattia's answer:

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

enter image description here

Upvotes: 6

Mattia Bianchi
Mattia Bianchi

Reputation: 302

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

Upvotes: 18

Related Questions