Visual Studio 2012 - Find and Replace - Backlinks

I have an XML file and I want to replace every time value from seconds to milliseconds.

For example, replace time="250" to time="250000" .

I tried using the following

 Find: time="([0-9]*)" Replace: time="$1000" 

However, this does not work - it replaces time="250" to time="$1000" . How can I get around this?

+4
source share
2 answers

The problem is that your replacement is not $1 , it is $1000 . Visual Studio does not know that you do not want to include these 3 0 in your backreference.

You can use {} around your trackback to tell Visual Studio what to use.

 Replace: time="${1}000" 

Be sure to note that Visual Studio 2010 and later used a different regular expression syntax, so this only applies to Visual Studio 2012 (and, presumably, for any new versions).

+9
source

Have you checked the Search Options extension menu + check the box next to Use regular expressions?

+1
source

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


All Articles