Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Wildcard/Regex for find & replace in Visual Studio

I need to replace different values of receiveTimeOut attribute with a receiveTimeOut="59:59:59" Can wild card search be used to achieve this task, in Visual Studio?

<endpoint receiveTimeOut="10:10:20" someOtherProperty="x1" yetAnotherProperty="y1" />
<endpoint receiveTimeOut="10:50:20" someOtherProperty="x2" yetAnotherProperty="y2" />
...
<endpoint receiveTimeOut="30:50:20" someOtherProperty="x3" yetAnotherProperty="y3" />

I tried: using wildcard option in Find & Replace dialog, receiveTimeOut="*" but this selects complete line, receiveTimeOut="10:10:20" someOtherProperty="x1" yetAnotherProperty="y1" />

As you might have guessed, I am editing WCF service web.config and have to do this task manually & repeatedly.

like image 834
Abhijeet Avatar asked Aug 12 '13 20:08

Abhijeet


1 Answers

Using the regex option...

Find: <endpoint receiveTimeOut="[^"]+"

Then...

Replace: <endpoint receiveTimeOut="59:59:59"

The [^"]+ part uses a negative character class that matches any character except for a double quote. The + will match it one or more times.

like image 170
Ahmad Mageed Avatar answered Oct 21 '22 16:10

Ahmad Mageed