Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio 2012- Find and Replace - backreferences

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

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

I tried using the following

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

Replace: time="$1000"

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

like image 276
Hari Avatar asked Dec 26 '22 03:12

Hari


2 Answers

The problem is that your replace isn't $1, it is $1000. Visual Studio doesn't know that you don't want to include those 3 0's in your backreference.

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

Replace: time="${1}000"

Obligatory note that Visual Studio 2010 and older used a different regular expression syntax, so this is only valid for Visual Studio 2012 (and presumably any newer versions).

like image 182
Joel Rondeau Avatar answered Jan 17 '23 07:01

Joel Rondeau


Have checked the "Find Options" expansion menu + checked the "Use Regular Expressions" checkbox?

like image 39
miskiw Avatar answered Jan 17 '23 06:01

miskiw