reg = /("([^\"]*(\.)?)*")|("([^\"]*(\.)?)*")|(/{2,}.*?( | |$))|(/*( |.)*?*/)/g; script.replace(reg, function(word) { // 去除注释后的文本 return /^/{2,}/.test(word) || /^/*/.test(word) ? "" : word; });