我很驚訝正則表達式我認爲我是閱讀障礙,當涉及到這些可怕的代碼位......無論如何,必須有一個更簡單的方法來做到這一點 - (即列出一組替換實例一行),任何人?提前致謝。多個正則表達式替換
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