Re: attn: regex gurus. can this be done with a regular expression or using a different technique?
- From: "ChrisB" <pleasereplytogroup@xxxxxxxxxx>
- Date: Thu, 23 Jun 2005 15:42:58 -0400
Thanks to Larry and Frans for their help.
Larry, your suggestion worked very well. Just had to make one change.
Apparently, (for some reason!?!?) Microsoft decided to switch the capture
characters from parentheses to brackets when using regular expressions
within Visual Studio's search/replace functionality.
So the final expressions that worked are:
Search: Test\({.*}, {.*}\)
Replace: Test(\2, \1)
Thanks Again!
Chris
<larrylard@xxxxxxxxxxx> wrote in message
news:1119517859.684122.171280@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
>
>
> ChrisB wrote:
>> Hello:
>>
>> A third party component (NUnit) being used by my c# code has undergone a
>> breaking change and, as a result, thousands of methods calls in my source
>> code need to be revised in the following way:
>>
>> // General example of the desired revision
>> RevisedMethod(stringA, stringB) // prior to change
>> RevisedMethod(stringB, stringA) // after change
>>
>> Basically, I need to switch *whatever* appears before the comma with
>> *whatever* appears after the comma. This change needs to take place in
>> literally thousands of places, and I was wondering if it is possible to
>> somehow accomplish the switch using the Visual Studio regex search and
>> replace feature. If so, what would the expression look like?
>
> Try this:
>
> Find:
> RevisedMethod\((.*), (.*)\)
>
> Replace:
> RevisedMethod(\2, \1)
>
> The ( ) in the Find expression 'tag' the captured texdt within, then
> the \1 \2 in the Replace expression refer to the 1st and 2nd such
> tagged strings from the Find.
>
> --
> Larry Lard
> Replies to group please
>
.
- Follow-Ups:
- a simple test. dont look
- From: Vicente García
- a simple test. dont look
- References:
- Prev by Date: Re: FolderBrowserDialog crashes on Windows 2000
- Next by Date: AsyncCallback vs. Old fashioned Events and Delegates
- Previous by thread: Re: attn: regex gurus. can this be done with a regular expression or using a different technique?
- Next by thread: a simple test. dont look
- Index(es):
Relevant Pages
|