当我在网上测试我的regex时(比如http://regex101.com),一切都很好。但是当我用javascript测试它时,它没有,我不知道我做错了什么。
var input = 'fzef zef zef zef (, ) dezdezfzef ezf ze';
input = input.replace('/\(\,?\s{0,}?\)/g', '');
console.log(input);谢谢
发布于 2014-11-27 12:15:45
您需要删除regex周围的引号:
input.replace(/\(\,?\s{0,}?\)/g, '')https://stackoverflow.com/questions/27170467
复制相似问题