Notepad++ 如何在一行中合并两个单独的行?
基本上这就是文本Notepad++ 如何在一行中合并两个单独的行?,notepad++,notepad,Notepad++,Notepad,基本上这就是文本 data data2 someotherdata someotherdata2 我希望他们像这样合并 data:data2 someotherdata:someotherdata2 有什么办法可以让这一切顺利吗?(在记事本++)在查找/替换对话框中,确保“点匹配换行符”处于关闭状态且正则表达式模式处于打开状态,然后将所有^(+)\r?\n?(.+)\r?\n?替换为$1:$2 Ctrl+H 查找内容:^.+\K\R 替换为:: 检查环绕 检查正则表达式 不要选中。匹配换行符
data
data2
someotherdata
someotherdata2
我希望他们像这样合并
data:data2
someotherdata:someotherdata2
有什么办法可以让这一切顺利吗?(在记事本++)在查找/替换对话框中,确保“点匹配换行符”处于关闭状态且正则表达式模式处于打开状态,然后将所有
^(+)\r?\n?(.+)\r?\n?
替换为$1:$2
- Ctrl+H
- 查找内容:
^.+\K\R
- 替换为:
:
- 检查环绕
- 检查正则表达式
- 不要选中
。匹配换行符
- 全部替换
^ : beginning of line
.+ : 1 or more any character but newline
\K : forget all we have seen until this position
\R : any kind of linebreak (ie. \r, \n, \r\n)
data:data2
someotherdata:someotherdata2
给定示例的结果:
^ : beginning of line
.+ : 1 or more any character but newline
\K : forget all we have seen until this position
\R : any kind of linebreak (ie. \r, \n, \r\n)
data:data2
someotherdata:someotherdata2
除了data:data2之外,它还添加了data:data2someothedaoh我修复了在它们之间添加空格的问题,非常感谢