我需要一个(TypeScript)正则表达式模式,它将匹配2个或更多不在语音或引号内的连续空格。
假设我有这个字符串:
"John Smith" and Sarah Brown are having 'a ' nice(" . ") day tod' 'ay.
我想匹配(然后删除)所有不在一对“”或“”内的2+白色空格子字符串。基本上,一对引号或引号中的任何内容都应该被忽略。有人能给我提供一个片段吗?
或者,有人能推荐一个合适的词法分析或解析npm库吗?我找到了this,但我不确定我是否能用它来执行此任务。
1条答案
按热度按时间vlju58qv1#
https://tsplay.dev/wX161N