开发者

Script consecutive Replace-All operations in Notepad++

开发者 https://www.devze.com 2023-04-11 08:32 出处:网络
Is there a way to script co开发者_运维百科nsecutive Replace-All operations in Notepad++? For example, I want to be able to first replace all “ characters with &ldquo and then to replace all

Is there a way to script co开发者_运维百科nsecutive Replace-All operations in Notepad++? For example, I want to be able to first replace all “ characters with &ldquo and then to replace all ” characters with &rdquo and then I would like to replace all "string1" with "string2", etc...


Nevermind,

I finally figured it out, and it seems like a great solution.

I used PythonScript for NotePad++ (which is what I started with but which kept giving me errors, until I finally fixed a few things).

So, here is the code for those who may be interested:

# This Python file uses the following encoding: utf-8
import os, sys
editor.replace(r"“",r"“")
editor.replace(r"”",r"”")
editor.replace(r"’",r"’")

the r before the quotation marks allows the use of special characters as they are, and this is what was so difficult for me to get working.

0

精彩评论

暂无评论...
验证码 换一张
取 消