ALPEREN BUĞRA AVCIL
ALPEREN BUĞRA AVCIL

Reputation: 19

How to Delete All Column Attribute in Models?

I have a problem on VS Code.

I want to delete just column attribute for 200 files.

How to delete them on one click?

I tried (.+?)[Column*/] on Regex Expression.

[Column("JOBSTOP")] public DateTime JobStop { get; set; }
[Column("JOBSTOPAVG")] public DateTime JobStopAvg { get; set; }
[Column("JOBSTOPPRJ")] public DateTime JobStopRj { get; set; }

I expect the output of [Column("JOBSTOP")] public DateTime JobStop { get; set; } to be public DateTime JobStop { get; set; }.

There are many files like this.

Upvotes: 1

Views: 43

Answers (2)

sachith sujeewa
sachith sujeewa

Reputation: 24

  1. go to the beginning of the line
  2. select multiple lines by pressing shift + alt, drag mouse down enter image description here

  3. select section by holding ctrl +shift and -> (right arrow) enter image description here

Upvotes: 1

Wiktor Stribiżew
Wiktor Stribiżew

Reputation: 627468

You may use

\[Column\("[^"]*"\)]\s*

If you do not care to check for double quotes use a shorter expression:

\[Column\([^)]*\)]\s*

Details

  • \[Column\(" - [Column(" string
  • [^"]* - 0+ chars other than " ([^)]* matches 0 or more chars other than ))
  • "\)] - a ")] substring
  • \s* - 0 or more whitespaces.

Demo

enter image description here

Upvotes: 0

Related Questions