我正在编辑一个大的YAML文件,并且多次出现在文本中(用占位符替换了实际文本):
options:
- placeholder1!
- this is a placeholder!
- %placeholderhere%!
- placeholder
- you get the point by now
- more placeholders
- one last placeholder...
this is just some text don't replace
options:
- placeholder1!
- this is a placeholder!
- %placeholderhere%!
- placeholder
- you get the point by now
- more placeholders
- one last placeholder...
我想把它变成这个:
options:
- placeholder1!
this is just some text don't replace
options:
- placeholder1!
感谢您的帮助:)
答案 0 :(得分:0)
输入
options:
- placeholder1!
- this is a placeholder!
- %placeholderhere%!
- placeholder
- you get the point by now
- more placeholders
- one last placeholder...
this is just some text don't replace
options:
- placeholder1!
- this is a placeholder!
- %placeholderhere%!
- placeholder
- you get the point by now
- more placeholders
- one last placeholder...
查找^options.*?- (placeholder1).*?placeholder...$
替换为-\1!
注意:不要忘记选中matches newline
复选框(仅限v6.0)
结果:
-placeholder1!
this is just some text don't replace
-placeholder1!