Replace 用记事本中的某些文本替换整行++;

Replace 用记事本中的某些文本替换整行++;,replace,notepad++,yaml,Replace,Notepad++,Yaml,我正在编辑一个大型YAML文件,并多次将其显示在文本中(将实际文本替换为占位符): 我想把它变成这样: options: - placeholder1! this is just some text don't replace options: - placeholder1! 感谢您的帮助:)输入 options: - placeholder1! - this is a placeholder! - %placeholderhere%! - placeholder - you get the

我正在编辑一个大型YAML文件,并多次将其显示在文本中(将实际文本替换为占位符):

我想把它变成这样:

options:
- placeholder1!
this is just some text don't replace
options:
- placeholder1!
感谢您的帮助:)

输入

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...
查找
^选项。*?-(占位符1)。*?占位符…$

替换为
-\1

注意:不要忘记选中
匹配换行符的复选框(仅限v6.0以后版本)

结果:

-placeholder1!
this is just some text don't replace
-placeholder1!

不知道为什么我被否决了。。。我打了个错字,我没有投你反对票,但你的问题有点不清楚。你想将几行减为一行吗?是的,但我想替换多组行,如replacethis replacethis just text replacethis replacethis replacethis change,全部替换为replacethis just text replacethis@RaGe
-placeholder1!
this is just some text don't replace
-placeholder1!