如何在Notepad++中加入多行?

How to join mutilines in the Notepad++?

我在Notepad++中有几千行数据需要修改,有的在合适的一行,以"$"结尾,有的数据应该在一行,现在却排成几行,怎么办将它们连接在一起并以“$”结尾? 这是数据样本:

1.we love it $      
2.its beautiful $
3.how

  can

  it? $
4. yes I love it $
5. sorry
   its
   ugly
   too $

对于那个样本,第1,2,4行在右边,但是对于第3和第5行,它分成多行,那么如何将它们连接在一起?PS:除了所有结束它有$,在其他内容中它没有更多的“$”

使用正则表达式替换:

find: (?<!$)[\n\r]+(( ) *)?
replace: 

</code> 保留连接行的前导空格之一(如果有)。</p> <hr> <p>根据您的输入,以上结果产生:</p> <pre><code>1.we love it $ 2.its beautiful $ 3.how can it? $ 4. yes I love it $ 5. sorry its ugly too $

请注意,您的示例输入是 "corrupt",因为它在 $ 之后有尾随空格(例如第一行),因此您必须先清理它。