我有大量相同格式的行,我想将斜线之间的文本添加到行尾,例如:
.replace(/10th Century/g,"
会成为
.replace(/10th Century/g,"10th Century
使用单行执行此操作没有问题,但是当我尝试一次性完成所有操作时,我遇到了问题。
每一行看起来都与上面的例子类似,每行的斜线之间有不同的单词。
.replace(/10th Century/g,"
.replace(/11th Century/g,"
ETC
我希望每行末尾的文本与每行斜线之间的文本相同
.replace(/10th Century/g,"10th Century
.replace(/11th Century/g,"11th Century
有什么办法可以做到这一点?
答案1
我想将斜线之间的文本添加到行尾
前:
.replace(/10th Century/g,"
.replace(/11th Century/g,"
后:
.replace(/10th Century/g,"10th Century
.replace(/11th Century/g,"11th Century