我正在尝试找到一个正则表达式,它可以删除字符串中的双字,但我想指定的某些字除外。
这是我正在使用的正则表达式
setFinal(final) {
// remove duplicated words and eventual initial/final spaces
let res = final.replace(/(\b\S.+\b)(?=.*\1)/g, "").trim();
// ... other code
}
如果我要指定不考虑的词,我该怎么做?
九州编程
尚方宝剑之说
相关分类