如何在Notepad ++中使用带有反向引用的正则表达式替换文本?

Nam*_* VU 1 notepad++ regex find-and-replace

我正在将 Windows 批处理脚本 .bat 转换为 Linux 批处理脚本 .sh

需要花费大量时间的是改变 .bat 脚本使用变量的方式。

IE

在 Windows 中

@set varName=122
echo %varName%
Run Code Online (Sandbox Code Playgroud)

在 Linux 中

varName=122
echo $varName
Run Code Online (Sandbox Code Playgroud)

那么问题来了,如何替换%.+%to $.+

Nam*_* VU 5

在“替换”对话框 ( Ctrl+ H) 中,使用以下内容:

查找内容:%(.+)%
替换为:$\1
搜索模式:正则表达式

替换对话框的屏幕截图