【发布时间】:2019-08-23 01:27:46
【问题描述】:
我正在尝试替换每次出现的逗号 ',',但前提是它位于两个数字/数字之间。
例如“Text, 10,10 text, 40 text, 10,60” 应返回为“Text, 1010 text, 40 text, 1060”,我替换 10,10 和 10,60,但在文本后保留逗号。
var text = "Text, 10,10 text, 40 text, 10,60";
var nocomma = text.replace(/,/g, '');
console.log(nocomma);
【问题讨论】:
标签: javascript regex replace