Replace regular expressions in Visual Studio

Using Visual Studio 2010 I would like to perform regular expression at the project level, as shown below.

Find: #region {any string here}

Replace: #region - string from above -

I tried the following:

 region\s'{[^]+}' region '{[^]+}' region {:q} 

But the IDE complains about the wrong template. How can i fix this?

+6
source share
2 answers

Ahhh, Visual Studio regular expressions ... They cannot be called regular expressions, because they diverge from much of what is "standard"

I started VS, and after some trial and error this worked:

Search:

 \#region \{{.*}\} 

replace:

 #region - \1 - 
+7
source

Try:

Search: {\#region:b+}{.*}

Replace: \1 - \2 -

If you are specifically looking for "{" and "}",

Search: {\#region:b+}\{{.*}\}

With quotes:

Search: {\#region:b+}{'.*'}

To remove quotes:

Search: {\#region:b+}'{.*}'

+5
source

Source: https://habr.com/ru/post/913923/


All Articles