我很惊讶正则表达式我认为我是阅读障碍,当涉及到这些可怕的代码位......无论如何,必须有一个更简单的方法来做到这一点 - (即列出一组替换实例一行),任何人?提前致谢。多个正则表达式替换
function clean(string) {
string = string.replace(/\@[email protected]/g, '').replace(/}/g, '@[email protected]');
string = string.replace(/\@[email protected]/g, '').replace(/{/g, '@[email protected]');
string = string.replace(/\@[email protected]/g, '').replace(/\"/g, '@[email protected]');
string = string.replace(/\@[email protected]/g, '').replace(/\:/g, '@[email protected]');
string = string.replace(/\@[email protected]/g, '').replace(/\,/g, '@[email protected]');
return string;
}
您能否提供一些示例输入? – Shekhar 2010-11-26 13:09:18
你究竟在做什么? – Gumbo 2010-11-26 14:14:20