3

As most of you probably know, the regular expressions used in Visual Studio's Find dialog are not the same as .NET Regex. This is a major PITA to me, and I often resort to external tools to search my code with regexes.

So, I have two questions:

  • Why on earth did the VS team introduce yet another new, non-standard regex syntax? Couldn't they use the existing .NET Regex class? I can't think of any good reason for this...
  • Is there a VS extension out there that would allow me to use the standard regex syntax in the Find dialog?

EDIT: I found two related suggestions on Connect:

The second one is actually more interesting, since it would provide an extensible solution...

There are also a few VS2010 extensions (like this one) that allow searching with regexes, but none of them integrates into the standard Find dialog, and they don't have the "find in files" feature.

Thomas Levesque
  • 286,951
  • 70
  • 623
  • 758
  • 1
    Why did the VS team introduce yet another regex syntax? I'm fairly certain the regex based Find & Replace *predates* .NET (I.e. Visual Studio 6), so it would have been fairly difficult to use it. And then you can't replace it due to backwards compatibility concerns... – Damien_The_Unbeliever Jan 01 '11 at 19:28
  • VS regex is a defacto standard because it has been around for so long. Just one among many. Of course it makes sense to support another standard. Or two, don't forget the C++ customers. Ask at connect.microsoft.com. I can't find any prior request, odd. – Hans Passant Jan 01 '11 at 20:41
  • @Hans Passant, I actually found two requests for that issue, see my updated question for details. – Thomas Levesque Jan 01 '11 at 22:01
  • For the first part of your question, see [this related question/answers](http://stackoverflow.com/questions/5181712/why-the-difference-between-net-regular-expressions-and-visual-studios-regular-e) – Tim Pietzcker Oct 13 '11 at 08:40

1 Answers1

1

Visual Studio 6 has Find & Replace using Regular Expressions. As such, it would be difficult for it to use a future product/framework to perform such a search

Damien_The_Unbeliever
  • 234,701
  • 27
  • 340
  • 448
  • Yes, but I don't think the first .NET version of Visual Studio used much of the existing VS6 codebase... They created a new IDE specifically for .NET, so they could (should?) have used .NET regexes – Thomas Levesque Jan 01 '11 at 19:40
  • @Thomas - They didn't rewrite VS 2002 from scratch - it relied on a lot of previous work. And even if they had re-written, there would have been backwards compatibility concerns (they still offer people VB6 era keyboard shortcuts when they first start VS2010...) – Damien_The_Unbeliever Jan 01 '11 at 19:46
  • OK, but in that case, perhaps they should have provided both "old style regex" and ".NET regex" options... – Thomas Levesque Jan 01 '11 at 19:49
  • @Thomas - oh, agreed on that. I, too, would like to use .NET regexes in such dialogs. But I can't work out a way to implement it myself in VS2010 (which is by far the most .NET extensible version so far). – Damien_The_Unbeliever Jan 01 '11 at 19:53
  • I hoped it would be possible to "plug" a custom engine that would appear in the dropdown list with "Wildcards" and "Regular expressions", but it looks like this list is hard-coded... too bad – Thomas Levesque Jan 01 '11 at 20:07