notepad++ 行合并

notepad++ line combine

我们有这个订单

129
12
2020
5424180606943758

我们需要这样

5424180606943758|12|2020|129

如何在记事本 ++ 或 onoter 应用程序中执行此操作

  • Ctrl+H
  • 查找内容:(\d+)\R(\d+)\R(\d+)\R(\d+)\R?
  • 替换为:|||
  • 检查 环绕
  • 检查 正则表达式
  • 全部替换

解释:

(\d+)           # group 1, 1 or more digits
\R              # any kind of linebreak
(\d+)           # group 2, 1 or more digits
\R              # any kind of linebreak
(\d+)           # group 3, 1 or more digits
\R              # any kind of linebreak
(\d+)           # group 4, 1 or more digits
\R              # any kind of linebreak, optional

替换:

          # content of group 4
|           # a pipe
          # content of group 3
|           # a pipe
          # content of group 2
|           # a pipe
          # content of group 1

屏幕截图(之前):

截图(之后):