简体   繁体   English

是否可以在记事本++中编写多个正则表达式搜索和替换命令的脚本?

[英]Is it possible to script multiple regex search-and-replace commands in Notepad++?

I have recently been having fun using regex successfully in Notepad++'s search and replace box. 我最近在Notepad ++的搜索和替换框中成功使用了正则表达式,这很有趣。

However, I now have a short list of lengthy search-and-replacements that I would like to do again to another file later, and rather than enter them manually again, I was hoping I could stick them in a script somewhere and point it at my next file. 但是,我现在有一个简短的冗长的搜索和替换列表,我想稍后再对另一个文件进行处理,而不是再手动输入一次,我希望可以将它们粘贴在脚本中的某个位置并指向我的下一个文件。

Is something like this possible in Notepad++? 在Notepad ++中有可能发生这种情况吗?

If not, please recommend something that does support such a scheme. 如果没有,请推荐一些并不支持这样的方案。

Notepad++ may not be the best tool for automated operations. Notepad ++可能不是自动化操作的最佳工具。 I would suggest a scripting language with a powerful regex engine like perl for this use. 对于这种用途,我建议使用一种脚本语言,如perl之类的功能强大的正则表达式引擎。 Please note though that your notepad++ regular expressions may not work with other engines right away. 请注意,尽管您的notepad ++正则表达式可能无法立即与其他引擎一起使用。

If you don't want to learn a new language just for this, perhaps you can use Macro recording for this. 如果您不只是想为此学习一种新语言,也许可以为此使用宏录制。 I never used that feature, but I guess this is what it was designed for ;) 我从未使用过该功能,但我想这就是它的设计宗旨;)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM