如何在 Visual Studio 中将代码中的字符串转换为大写?

发布于 2024-08-03 06:38:54 字数 110 浏览 3 评论 0原文

我试图将文件中与特定正则表达式匹配的所有字符串转换为大写,但在 Visual Studio 的“查找和替换”窗口中找不到指定该字符串的语法。是否可以使用 Visual Studio 正则表达式来执行此操作?

I'm trying to convert all character strings that match a particular regex in a file to uppercase, but I can't find the syntax to specify that within the 'Find and replace' window in Visual Studio. Is it possible to do this using the Visual Studio regex?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

绅士风度i 2024-08-10 06:38:54

正如 JaredPar 所解释的,这不能使用通用正则表达式搜索/替换来完成。但是,我想您应该能够使用 来执行此操作宏

As JaredPar has expained, this cannot be done using a generic regular expression search/replace. However, I guess you should be able to do this using a macro.

Bonjour°[大白 2024-08-10 06:38:54

无法使用 Visual Studio 正则表达式将其作为通用替换。可以使用 \n 转义序列将捕获的文本重新用作替换字符串的一部分,其中 n 表示第 n 组捕获的文本。然而,正则表达式语言仅支持对此文本的有限修改(主要是理由更改)。它不允许您更改大小写。

以下是 Visual Studio 正则表达式语言的链接

It's not possible to do this as a generic replacement using Visual Studio regular expressions. It is possible to re-use the captured text as part of a replacement string using the \n escape sequence where n represents the nth group of captured text. However the regex language only supports limited modifications on this text (mostly justification changes). It doesn't allow you to change case.

Here is a link to the Visual Studio regex language

朱染 2024-08-10 06:38:54

当查找窗口获得焦点时按 alt + 'e' 以启用“正则表达式”搜索。

当然,您无法“编程”一组替换选项以根据找到的内容插入。每套替换品都需要一次通过。

press alt + 'e' when the find window has focus to enable "regex" searches.

naturally, you can't 'program' a set of replacement options to insert based on what is found. Each replacement set would require one pass.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文