英文:
Combine/Join lines in Notepad++ based on separator
问题
抱歉,以下是您要翻译的内容:
I have a text log file in the following format.
Is there a way in Notepad++ to combine lines between the " *" separators so the data looks like below
Thanks!
英文:
I have a text log file in the following format.
****************************************************************************************
line1
line2
line3
****************************************************************************************
line4
line5
line6
****************************************************************************************
Is there a way in Notepad++ to combine lines between the "*" separators so the data looks like below
****************************************************************************************
line1 line2 line3
****************************************************************************************
line4 line5 line6
****************************************************************************************
Thanks!
答案1
得分: 1
-
<kbd>Ctrl</kbd>+<kbd>H</kbd>: 按下Ctrl + H
-
Find what:
(?<!\*)\R(?!\*)
: 查找内容:(?<!\*)\R(?!\*)
-
Replace with:
-
SELECT Regular expression: 选择 正则表达式
-
<kbd>Replace all</kbd>: 按下Ctrl + H中的“替换全部”
英文:
- <kbd>Ctrl</kbd>+<kbd>H</kbd>
- Find what:
(?<!\*)\R(?!\*)
- Replace with:
- SELECT Regular expression
- <kbd>Replace all</kbd>
Explanation:
(?<!\*) # negative lookbehind, make sure we haven't a * before
\R # any kind of linebreak
(?!\*) # negative lookahead, make sure we haven't * after
Screenshot (before):
Screenshot (after):
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论