所以我有大约40k行INSERT
,如下所示:
INSERT INTO dbo.table (something) values ('something') GO
但我想使用Regex:将单词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$1')
console.log(res)