Notepad++ 尝试在每行的第 5 个 space 之后添加一个新行

Notepad++ Trying to add a new line after ONLY the 5th space in each line

示例 link 但我不知道如何为我做.. https://superuser.com/questions/1087902/notepad-trying-to-add-a-character-after-only-the-first-space-in-each-line

短篇小说:我有一长串不同的字符,我认为唯一的方法是在 5 space 之后换行“输入”我希望你能帮助我..示例情况:

bkasdmandrilla 123 vls inlloagribizvvaclog12om V#"log7 bkasdmandrillapp1hsa 123 vls asd1inovausv1om dyVUIKm-xPPqLFQzCm9RJQ

我在 notepad++ 中添加命令后如下所示:

bkasdmandrilla 123 vls inlloagribizvvaclog12om V#"log7
bkasdmandrillapp1hsa 123 vls asd1inovausv1om dyVUIKm-xPPqLFQzCm9RJQ

有点帮助?如果不存在方法,则有 1-2-3k 行需要手动操作。:( 我希望存在一个魔法。

新消息:我有多个文本 large/small 文本不同,但 alwasys 将是 5 space ,我需要换行。我希望魔法存在.. 非常抱歉我的英语不好。 (是的,在我的原始文件中,我只有 1 行大文本,正好在 5 space 之后,我需要向它们添加新行)

没有魔法,find/replace 正则表达式示例可以像这样:

正则表达式,解释:

查找:((\d+ ){5})

The first and last (  ) captures everything matched inside as a group (to use with replace)
Inside, the (\d+ ){5} pattern:
(\d+ ) matches 1 or more digits followed by a single space
{5}    match the digits-followed-by-a-space pattern, repeated 5 times.

替换:\n

  the group match of the five digits-followed-by-a-space pattern (from the find)
\n  a newline

请注意,将在替换中的换行符之前留下尾随 space,如图所示。但是,Macro 菜单有一个 Trim Trailing and save 选项,可用于删除这些选项。

  • Ctrl+H
  • 查找内容:^(?:\S+\h+){4}\S+\K\h+
  • 替换为:\n\r\n,具体取决于平台
  • 检查 环绕
  • 检查 正则表达式
  • 全部替换

解释:

^                   # beginning of line
    (?:             # non capture group
        \S+           # 1 or more non space
        \h+           # 1 or more horizontal space
    ){4}            # end group, must appear 4 times
    \S+             # 1 or more non space
    \K              # forget all we have seeen until this position
    \h+             # 1 or more horizontal space

屏幕截图(之前):

截图(后):