Using Wildcard/Regex for find & replace in Visual Studio

regex, visual-studio-2010

Solution

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.

Problem

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.

Original source