Replace all attributes in Visual Studio

Refresh

February 2019

Views

224 time

1

I have many cs files, with the next annotation:

[Js(Md.pr, imo = false, tr="csc")]

where the tr value is changed between each cs file.

I want to delete all these annotation automaticlly. So I try to use "replace all" in Visual studion, when I choose regular expressions function. So I wrote:

find what: [Js*]
replace with ''

and It finds many characters in the code, which I don't want to delete.

How can I do it?

2 answers

4

I think you're are looking for the following regex:

\[Js.*\]

The char [ is a special char in regex, so it has to be escaped.

\[ = [

. = Matches any single character except a line break.

* = Matches zero or more occurrences of the preceding expression, and makes all possible matches.

More information surf to: http://msdn.microsoft.com/en-us/library/2k3te2cs%28v=VS.100%29.aspx

Kai
0

Try regular expression.

\[Js\b(.*?)\)\]

while find and replace.