简体   繁体   English

Notepad ++替换所有以

[英]Notepad++ Replace all lines starting with

Here is the original line: 这是原始行:

Ore(DIAMOND_ORE,7,1,100.0,0,16,STONE)

I have 320 files containing that but with other params, I just want to search for: 我有320个包含该文件的文件,但带有其他参数,我只想搜索:

Ore(DIAMOND_ORE

And replace the whole line by: 并将整个行替换为:

Ore(DIAMOND_ORE,1,1,1,0,5,STONE)

How can I do that? 我怎样才能做到这一点?

Thanks 谢谢

The search regex you want is ^Ore\\(DIAMOND_ORE.* 您想要的搜索正则表达式是^Ore\\(DIAMOND_ORE.*

The ^ character means match the beginning of a line and the .* means match any character any number of times. ^字符表示匹配行的开头, .*表示匹配任意字符多次。

For a single file you can use the simple search and replace feature. 对于单个文件,您可以使用简单的搜索和替换功能。

Make sure the find and replace box has Regular Expressions checked and that . 确保“查找和替换”框已选中“ 正则表达式”,并且选中 matches newline is not checked. 匹配换行符 没有被选中。

Then set your replacement text to 然后将替换文字设置为

Ore\\(DIAMOND_ORE,1,1,1,0,5,STONE\\)

Your search and replace box should look like this: 您的搜索和替换框应如下所示:

在此处输入图片说明

Hit Replace All . 点击全部替换 Done. 完成。

I have 320 files containing that but with other params 我有320个文件,但包含其他参数

If you have multiple files to process, just click on the Find in Files tab and set your filter and directory, and then hit Replace in Files . 如果要处理多个文件,只需单击“ 在文件中查找”选项卡并设置过滤器和目录,然后单击“ 在文件中替换” I recommend you back-up your target files first though. 我建议您先备份目标文件。

Set search mode "Regular expression"
Find what: ^Ore\(DIAMOND_ORE.*
Replace with: Ore\(DIAMOND_ORE,1,1,1,0,5,STONE\)

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

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