我有一个 JavaScript 字符串数组,其同义词由插入符号指示。示例如下:
I'm baffled^bemused by his decision.
"Why are you so mean^nasty?" she wailed^moaned.
我想返回:
I'm baffled by his decision.
"Why are you so mean?" she wailed.
这/\^([^^]*)\./
适用于单个标点符号,但我无法让它为[.,:;?"' ]
. 我很感激这方面的帮助。