将特定单词转换为大写

New*_*rld 8 notepad++ regex

我有一个文档,其中包含以下划线(“_”)开头的特定单词。我需要记事本++的正则表达式将其更改为大写。

我试过这个,但它不起作用:

_\w+
Run Code Online (Sandbox Code Playgroud)

Sad*_*nny 16

搜索:

(_\w+)
Run Code Online (Sandbox Code Playgroud)

替换为:

\U$1
Run Code Online (Sandbox Code Playgroud)

......你完成了!(确保单击左下角的“正则表达式”单选按钮。)

我的测试如下。

前:

Hi, this is a test _with some _words starting _WITH _Underscores
Let's try to _toUpper them all!
Run Code Online (Sandbox Code Playgroud)

后:

Hi, this is a test _WITH some _WORDS starting _WITH _UNDERSCORES
Let's try to _TOUPPER them all!
Run Code Online (Sandbox Code Playgroud)

祝你好运!

  • `\L` 转换为小写,`\E` 结束转换。[来源](/sf/ask/72745851/#16830360)。 (7认同)