如何在1行中合并2条单独的行?

时间:2018-09-30 08:41:29

标签: notepad++ notepad

基本上这是文本

data
data2
someotherdata
someotherdata2

我希望他们像这样合并

data:data2
someotherdata:someotherdata2

有什么办法可以使我工作? (在记事本++上)

2 个答案:

答案 0 :(得分:1)

在“查找/替换”对话框中,确保“点匹配换行符”已关闭并且正则表达式模式已打开,然后将所有^(.+)\r?\n?(.+)\r?\n?替换为$1:$2

答案 1 :(得分:0)

  • Ctrl + H
  • 查找内容:^.+\K\R
  • 替换为::
  • 检查环绕
  • 检查正则表达式
  • 请勿检查. matches newline
  • 全部替换

说明:

^           : 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
相关问题