Notepad++ 是否可以在记事本+;中找到任意字符+;?
我的文件如下所示:Notepad++ 是否可以在记事本+;中找到任意字符+;?,notepad++,Notepad++,我的文件如下所示: Recipe: Trigger Ingredients { Electronics: 2 Wood: 1 Iron: 3 } Recipe: Console Ingredients { Electronics: 8 Glas: 5 Iron: 6 } Recipe: Trigger Ingredients { Electronics: 20 Wood: 1 Iron: 3 } Recipe: Con
Recipe: Trigger
Ingredients
{
Electronics: 2
Wood: 1
Iron: 3
}
Recipe: Console
Ingredients
{
Electronics: 8
Glas: 5
Iron: 6
}
Recipe: Trigger
Ingredients
{
Electronics: 20
Wood: 1
Iron: 3
}
Recipe: Console
Ingredients
{
Electronics: 80
Glas: 5
Iron: 6
}
等等
我需要的是,每个电子产品-数量乘以10
因此,我的文件如下所示:
Recipe: Trigger
Ingredients
{
Electronics: 2
Wood: 1
Iron: 3
}
Recipe: Console
Ingredients
{
Electronics: 8
Glas: 5
Iron: 6
}
Recipe: Trigger
Ingredients
{
Electronics: 20
Wood: 1
Iron: 3
}
Recipe: Console
Ingredients
{
Electronics: 80
Glas: 5
Iron: 6
}
我的问题:是否可以使用Replace函数执行此操作
为此,我必须忽略金额,并在其后面添加一个0
比如:
查找全部:“电子:*”
替换为:“电子设备:*0”
其中*将是它应该忽略的字符
我就是这样想的:
勾选环绕
和正则表达式
。那就试试这个
Find what : ^( Electronics: \d)
Replace with: \10
- Ctrl+H
- 查找内容:
\bElectronics:\h+\d+\K
- 替换为:
0
- 检查环绕
- 检查正则表达式
- 全部替换
说明:
\b # word boundary
Electronics: # literally
\h+ # 1 or more horizontal spaces
\d+ # 1 or more digits
\K # forget all we have seen until this position
Recipe: Trigger
Ingredients
{
Electronics: 20
Wood: 1
Iron: 3
}
Recipe: Console
Ingredients
{
Electronics: 80
Glas: 5
Iron: 6
}
给定示例的结果:
\b # word boundary
Electronics: # literally
\h+ # 1 or more horizontal spaces
\d+ # 1 or more digits
\K # forget all we have seen until this position
Recipe: Trigger
Ingredients
{
Electronics: 20
Wood: 1
Iron: 3
}
Recipe: Console
Ingredients
{
Electronics: 80
Glas: 5
Iron: 6
}
是的,是的possible@HaBom我该怎么做?您的评论还不是很有帮助…抱歉,我忘记了链接我尝试过,但它告诉我“全部替换:0个引用已被替换”。您是否将cirsor放在文本文件的顶部,以便搜索每一行?是的。我在没有^-char的情况下尝试了它,然后它正确地找到了它们,但是现在Replace-with行仍然是错误的-它只是用“/10”替换了它?是的,^
表示追加。哦,我知道你为什么会出错,检查我的编辑答案。我成功了,我在问题中添加了一个截图。谢谢你的帮助@阿尔帕卡乔:注意,这只适用于整数,不适用于浮点。