Invert assignment direction in Visual Studio
regex, visual-studio
Solution
Select the lines you want to swap, Ctrl+H, then replace:
{:i}:b*=:b*{:i};
with:
\2 = \1;
with "Look in:" set to "Selection"
That only handles C/C++ style identifiers, though (via the ":i"). Replace that with:
{.*}:b*=:b*{.*};
to replace anything on either side of the "=".
Also, since you mentioned in a comment you use ReSharper, you can just highlight the "=", Alt+Enter, and "Reverse assignment".
Problem
I have a bunch of assignment operations in Visual Studio, and I want to reverse them: i.e ``` i = j; ``` ` would become ``` j = i; ``` i.e. replacing everything before the equals with what's after the equals, and vice versa Is there any easy way to do this, say something in the regular expression engine?