查找和替换大量代码的最佳方法是什么(Sublime Text)

What is the best way to find and replace a large amount of code (Sublime Text)

我一直在 HTML 中使用我不满意的 class 命名约定。我想将我的 classes 从 "myClass" 更改为样式 "my-class"。但是,这些 classes 出现在多个文件中,手动检查和执行将花费大量时间。

Sublime Text 中的搜索和替换需要相当长的时间来遍历所有文件,我也会更改日志文件中的 class 名称(不确定这是否是好的做法) .

提前致谢,

我将忽略 'The search and replace in Sublime Text takes quite a long time to go through all the files' 因为这似乎是一个陈述而不是一个问题。如果你在那里有问题,你可能想直接问。

我会把 'I would be changing the class names in my log files too' 当作这个问题来对待。 'Is there a way to change the .html files in my project without changing the log files?' 如果这不是您的问题,那么请提出您真正想要回答的问题。

所以假设 'Is there a way to change the .html files in my project without changing the log files?' 是问题,那么:

1 - 阅读此项目 Search in all files in a project in Sublime Text 3

正如那里所讨论的那样,您可以通过使用面板中间字段中的修饰符来限制查找(在您的情况下是查找和替换)。

要将范围限制为以 .html 结尾的文件,请将此 *.html 添加到中间字段(在文件夹路径之后)。这意味着您只能在 html 个文件中找到并忽略所有其他文件类型。我假设您的日志文件是 .txt.html.

以外的某些文件后缀