Notepad++ 将特定行与第二行合并

Notepad++ Combine Specific Line with second line

我正在尝试将以“文本”开头的每一行与第二行合并:

Text 1  
    Line 1  
    Line 2  
    Line 3  
    Line 4
Text 2  
    Line 1  
    Line 2  
    Line 3
Text 3  
    Line 1  
    Line 2  
    Line 3  
    Line 4  
    Line 5  
    Line 6 
Text 4
    Line 1
    Line 2

我希望它看起来像这样。

Text 1      Line 1  
    Line 2  
    Line 3  
    Line 4
Text 2      Line 1  
    Line 2  
    Line 3
Text 3      Line 1  
    Line 2  
    Line 3  
    Line 4  
    Line 5  
    Line 6 
Text 4      Line 1
    Line 2

我已经设法将它们组合起来,但问题是它删除了数字,所以它最终像“Text Line 1”而不是“Text 1 Line 1”。我也想保留选项卡 space。

  • Ctrl+H
  • 查找内容:(^Text.*)\R
  • 替换为:</code></li> <li><strong>检查</strong> <em>环绕</em></li> <li><strong>检查</strong> <em>正则表达式</em></li> <li><strong>取消选中</strong> <code>. matches newline
  • 全部替换

解释:

(           # start group 1
^           # beginning of line
Text        # literally Text
.*          # 0 or more any character but newline
)           # end group
\R          # any kind of linebreak

替换:

          # content of group 1

屏幕截图(之前):

截图(后):