VS2012 Replace All does not do the same thing as Find Next, Replace.
-
Monday, September 10, 2012 6:25 PM
I'm trying to use Visual Studio's Replace All feature with a regular expression.
Here is my pattern: "^(?<before>[^\r\n]*\w[^/\r\n]*)///(?=[^<])" with "${before}///<"
What is should find:
int 0; /// comment
And replace it with:
int 0; ///< comment
"Find Next" and "Find All" buttons from the "Find in Files" dialog finds occurrences of my pattern.
"Find Next" button from the "Replace in Files" dialog finds occurrences of my pattern.
"Replace" button from the "Replace in Files" dialog transforms the text like I expect.
"Replace All" button from the "Replace in Files" doesn't find any occurrences of my pattern.
Why doesn't "Replace All" find the same regex matches that "Find Next" and "Find All" do?
Update:
Replace All “(?<before>^[^\r\n]*\w[^/\r\n]*)///” with “${before}///<” works.
Replace All “(?<before>^[^\r\n]*\w[^/\r\n]*)///[^<]” with “${before}///<” works.The problem is the look ahead block "(?=[^<])".
I've used look ahead blocks in other regex with Replace All , so I'm not sure why it doesn't work in this case.
Aron Curzon
- Edited by Aron D Curzon Tuesday, September 11, 2012 5:31 PM
All Replies
-
Tuesday, September 11, 2012 8:19 AMModerator
Hi Aron,
I'm trying to involve some senior engineers into this issue and it will take some time. Your patience will be greatly appreciated. Thanks for your understanding.
Bob Shen [MSFT]
MSDN Community Support | Feedback to us
-
Thursday, September 13, 2012 3:00 PMModerator
Hi Aron,
It's a strange issue. I tested in the latest version -- VS2012 and I can repro the problem. I suspect it's a product issue and I would strongly recommend you open a bug report in http://connect.microsoft.com
Luckily, as you mentioned, we have other workable patterns to use. :)
Good day!
Thanks
Michael Sun [MSFT]
MSDN Community Support | Feedback to us
-
Thursday, September 13, 2012 6:05 PM
Thanks for reproducing the issue. I've opened a bug report here:
Aron Curzon
- Marked As Answer by Michael Sun [MSFT]Microsoft Employee, Moderator Friday, September 14, 2012 1:34 AM
-
Friday, September 14, 2012 1:33 AMModerator

