在 Notepad++ 中将行的最后一个字转移到新行

Transfer last word of the line to a new line in Notepad++

所以我有大约 40k 行 INSERT 像这样:

INSERT INTO dbo.table (something) values ('something') GO

但我想使用正则表达式将单词 GO 移到新的一行:

   INSERT INTO dbo.table (something) values ('something') 
    
    GO

我该怎么做?

只需提取 GO 并将其替换为 \nGO

试试这个:

const input = `
INSERT INTO dbo.table (something) values ('something') GO
INSERT INTO dbo.table (something) values ('something') GO
INSERT INTO dbo.table (something) values ('something') GO
`

const res = input.replace(/(\w+)$/gm, '\n')
console.log(res)