在 Visual Studio 的“查找”对话框中使用标准 .NET 正则表达式
大多数人可能都知道,Visual Studio 的“查找”对话框中使用的正则表达式 与 .NET Regex 不同。这对我来说是一个主要的 PITA,我经常求助于外部工具来使用正则表达式搜索我的代码。
所以,我有两个问题:
- VS 团队到底为什么要引入另一种新的、非标准的正则表达式语法?他们不能使用现有的 .NET Regex 类吗?我想不出任何好的理由...
- 是否有 VS 扩展允许我在“查找”对话框中使用标准正则表达式语法?
编辑:我在 Connect 上发现了两个相关建议:
第二个实际上更有趣,因为它将提供可扩展的解决方案...
还有一些 VS2010 扩展(例如 这个)允许使用正则表达式进行搜索,但它们都没有集成到标准查找对话框中,并且他们没有“在文件中查找”功能。
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:
- Please consider using the same regex syntax for Find/Replace and the Regex class
- Modify Visual Studio Find And Replace To Accept other Non MS Text Matching Engines
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Visual Studio 6 具有查找和查找功能。替换使用正则表达式。因此,它很难使用未来的产品/框架来执行这样的搜索
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