我正在寻找一种解决方案,可以将以n't结尾的所有单词替换为2部分,例如“ has n't”为“ has not”或“ was n't”为“ was not”。
现在我有以下解决方案,但是我必须对所有想做的单词都做一遍:
hero.service.ts:19 entered at service
hero.service.ts:22 chnage getted ab
detail.component.ts:23 text detail ab
hero.service.ts:18 ___________________________
hero.service.ts:19 entered at service
hero.service.ts:22 chnage getted cd
detail.component.ts:23 text detail cd
hero.service.ts:18 ___________________________
hero.service.ts:19 entered at service
hero.service.ts:22 chnage getted ef
detail.component.ts:23 text detail ef
答案 0 :(得分:1)
这里是使用正则表达式grouping ()
gsub("(.*)(n\\'t)","\\1 not","haven't")
[1] "have not"