Jonathan Henson
Jonathan Henson

Reputation: 8206

Visual Studio Regular Expressions Find/Replace not working as I expect

I am trying to match

EchoCancellation = Convert.ToBoolean(SendReceivePackets.GetNameValuePairsFromUnparsedReply(parsedReply["EchoCancellation"]));

and change it to:

EchoCancellation = Convert.ToBoolean(parsedReply["EchoCancellation"]);

There are about 3000 of these.

Here is my regex:

SendReceivePackets\.GetNameValuePairsFromUnparsedReply\(parsedReply\["{\w*}"\]\)

Visual studio says it can't find it. I don't believe Visual Studio, I think it is just lazy. :)

Can anyone see the problem?

Upvotes: 1

Views: 922

Answers (1)

Jack
Jack

Reputation: 5768

The \w should be :w.

Visual Studio uses non-standard regex. Change your regex to

SendReceivePackets\.GetNameValuePairsFromUnparsedReply\(parsedReply\[":w"\]\)

Check here: http://msdn.microsoft.com/en-us/library/2k3te2cs%28v=vs.80%29.aspx

Upvotes: 1

Related Questions